HNHacker News
TopNewBestAskShowJobs

KayEss

489 karma · joined July 9, 2007

submissionscomments
KayEss··on Languages I want to write
I think the closest you can get is something like:

    class odd {...};
    class even {...};

    std::variant<odd, even> p(int a) {
        if (a&1) return odd{a};
        else return even{a};
    }
Now which of `even` or `odd` you get is based on the value of `a`.
KayEss··on The password “ji32k7au4a83” has been seen over a hundred times
My ~/bin/makepass file:

    #! /bin/bash
    cat /dev/urandom | base64 --wrap ${1:-"10"} | head -n 1
Defaults to 10 character passwords, but you can put bigger numbers as the first argument. I don't think the `base64` command is on the Mac, so probably won't work there.
KayEss··on Explaining Code Using ASCII Art
We're experimenting with Mermaid diagrams <https://mermaidjs.github.io/> in our source code. How does that come across?
KayEss··on Build me a Lisp
LOL
KayEss··on Build me a Lisp
What is the observable effect then? I can really only think of two: A particular performance characteristic, or that modifications of shared tails in lists are observable across lists. Is this latter that is the problem?
KayEss··on Build me a Lisp
Lambdas have an un-utterable type, so the addition of a template like mechanism in their arguments is something the compiler can do behind the scenes and it all just works. Look for "generic" in this page <https://en.cppreference.com/w/cpp/language/lambda>
KayEss··on Build me a Lisp
The auto there works like a templated function would (except it's anonymous as you'd expect from a lambda).
KayEss··on Build me a Lisp
Ah, that's really interesting. This one only has a single namespace, but the one I simplified it from actually has two. I guess that makes that one a Lisp 2 :-)
KayEss··on Build me a Lisp
Follow the link to the Gist <https://gist.github.com/KayEss/45a2e88675832228f57e2d598afc0... and your code editor should give you the comment folding you want.
KayEss··on Build me a Lisp
Yeah, it's deliberately simplified in order to keep things short and sweet. Maybe I'll write some more posts that extend this into a real language and then these things will come out.

I really wanted to show that core part of a programming language can be quite simple and nothing to be afraid of so everything else was subservient to getting that across :-)

KayEss··on Build me a Lisp
Part of the motivation for writing this up is to explain internally about a DSL used for testing web APIs, for example: <https://github.com/KayEss/fostgres/blob/master/Example/films...

I expect we'll extend use of this sort of mechanism much further the more people understand it.

I'll watch that video, sounds interesting. A company I worked for nearly ended up getting a Symbolics LISP machine for CGI in the early 90s. Would have been pretty sweet I think.

KayEss··on Ask HN: What books changed the way you think about almost everything?
The word "revolution" is probably the most deeply ironic one in the whole of the English language. You fight and die to overthrow the oppressor only to end up back where you started.
KayEss··on Ranges, Code Quality, and the future of C++
> If the complexity can be reduced (by say, adding garbage collection)

Adding a garbage collector would make code more complex, not simpler, as it would break RAII. I spend a lot more time dealing with memory and resource allocation issues in GC languages than I do in C++.

In languages like Python we have to use `with`, and this is harder to use in the client code, and the class is much harder to write, than anything in C++ where we just add a destructor to clean up.

    std::vector<char> data(10 << 20);
    std::ifstream("/dev/urandom", std::ios::binary).read(data.data(), data.size());
The above code can never leak (either memory or file handles) under any circumstances and the implementations of the types involved push zero overhead/boilerplate on me as a user of them.

I think if you want to reduce complexity of C the place that everybody else is looking is at how to allow opting in and out of legacy support.

KayEss··on SQL as an API language
The thing I disliked about it is that the APIs were very ugly. We ended up building our own tool that allows for much nicer APIs to be built: <https://github.com/KayEss/fostgres>
KayEss··on Running a database on EC2? Your clock could be slowing you down
With the instance types they're using the migration isn't really an option because the point of the i3 instances is the locally attached NVMe SSD disks where the database files are.
KayEss··on EU to stop changing the clocks in 2019
And then some idiots do a referendum and the state ends up voting itself out of the union?
KayEss··on The Five Levels of Logging
That depends on the nature of the program. We use error and critical for server software. If there is a protocol violation on a particular connection, log an error and drop the connection, but otherwise continues. If the `accept` system call fails that's critical and the program shuts down. Depending on what we're doing there may be other critical operations, but some software doesn't have any.
KayEss··on Why Y? Deriving the Y Combinator in JavaScript
Useful when you have a lambda that needs to call itself, but the language doesn't bind the name until after the lambda is parsed (so you can't call by name). This happens in a few languages I think, C++ and C# for sure.
KayEss··on Twitter’s deletion of its FB app caused old cross-posts to temporarily disappear
> Deleting years of stuff that might not exist in other places would certainly be much more draconian.

This is exactly what the report says they did. The original post may exist on Twitter, but the conversation that happened on Facebook does not.

I just checked my feed, and my Twitter posts do seem to still be on my FB profile, at least when I look at it.

KayEss··on My adventures getting Disney’s Moana island scene to render well with Pbrt
I've been playing around with a slightly different non-OO approach. The use of sum and product types taken more from functional programming. You can see some of the results here: <https://github.com/KayEss/AnimRay/tree/feature/animation/ani... (needs to be that branch for anything interesting right now).

It's really incomplete, and I have had hardly any time to work on it over the many years that it's been around, but the general idea is to type construction to determine the aspects that a scene actually uses and let the compiler sort out what to do about it.

For example, the depth count attached to a ray doesn't appear until it hits a reflective surface so there is no overhead if the scene doesn't need it. As you can probably imagine the template errors can be obscene :)

The next thing would be to constexpr everything so that the scene could be built up in the compiler, I guess ideally in parts and then combined by the linker. I think it'll be really fun to try that with this Moana scene, but don't expect the compilers or linkers will survive let alone the tracer

EDIT to say, I really love your book. I feel hugely inspired every time I look at it, which unfortunately means I can't look too often as I don't have the time to play with these things as much as I'd like.

KayEss··on The hotel bathroom puzzle
Central locking: if you're in the centre of the car yu can lock all the doors.
KayEss··on A one word change to the C standard to make undefined behavior sane again
I don't think that is what the article is arguing for. There it would be more akin to "absolutely limited to" as they don't want anything outside of the examples. Unfortunately for them the examples are still open enough to allow for what compilers do (things like remove code that the author intended be left in).

Personally I'm OK with the more aggressive optimisations, but they are still very controversial -- I think more so in the C than the C++ community (I'm in the C++ one).

KayEss··on Phantom traffic jams, and why lane expansion isn’t really successful
Here in Bangkok the size of the (already legendary) traffic jams is certainly a great proxy for the economy as a whole.
KayEss··on Why “children,” not “childs”? (2016)
And "an ewt" became "a newt", so it goes both ways.
KayEss··on Now Is the Perfect Time for an RSS Renaissance
Dynamic updates. So long as you're not behind carrier NAT you can find your IP number and update a DNS record. Many DNS providers have a specific service for this, e.g. https://dyn.com/dynamic-dns/ (no affiliation, just used them many years ago for this service).

Many ISPs are switching to carrier NAT though and then you can't host as you don't have a routable IP number.

KayEss··on What is happening in the Arctic is now beyond words, so here are the pictures
Once they fall into the sea the displacement occurs. It doesn't matter after that how long they take to melt, all that matters is that they fall off land and into the ocean.

So melting is an issue only for ice that melts on land and then flows into the oceans because that represents new water volume.

KayEss··on What is happening in the Arctic is now beyond words, so here are the pictures
Of course they don't need to actually melt to affect sea rises, they just have to fall into the ocean.
KayEss··on RFC: Ubuntu 18.04 LTS Minimal Images
I'd been doing the same thing for a long time (loved how fast it was compared to the normal installer, especially in a VM), but the last install I did was with debootstrap straight onto the target disk from another running machine. A bit of a learning curve the first time, but I think I'll try it again next time.
KayEss··on C++ and the Culture of Complexity (2013)
Argh, I misread what you wrote. It's very late here now :)
KayEss··on C++ and the Culture of Complexity (2013)
I suggested many many years ago that Erlang was an OO language and of course the community ripped me to pieces for it :) I was very pleased to see him eventually come out on my side.
← PreviousPage 2 of 7Next →