Better HN
topnewbestaskshowjobs
Log inSign up

KayEss

489 karma · joined Jul 9, 2007 (19y ago) · 207 submissions

Submissions

comment 7y ago · link · parent

> they forgot that it's about telling the computer to do something, as clearly as possible

Or alternatively, it's to explain to the next reader of the code, as clearly as possible, how the problem was solved (in such a way that it can also be executed by the computer).

comment 7y ago · link · parent

> Some people think that a day is one revolution of Earth's axis, and not exactly 86400 seconds

One day is more than one revolution of the planet. The sidereal day is exactly one rotation of the planet, but that's about four minutes shorter than a civil day.

The reason is that the planet also moves around the sun, so in order to get the sun to the same position in the sky for noon the planet needs to turn a little bit more than 360 degrees, about 360/365 extra.

comment 7y ago · link · parent

I was wondering what happens if you skip the SNI bit and just rely on the Host header in the data. Does that work?

comment 7y ago · link · parent

Not too surprising I think. The charger is 135W

https://www.lenovo.com/us/en/laptops/thinkpad/thinkpad-x/Thi...

comment 7y ago · link · parent

Yes it does.

comment 7y ago · link · parent

I get my X1 Extreme on Sunday -- had to order through a friend in the UK because the price in Thailand is nearly 2 times the UK one and in any case nobody has one.

Been a big fan of the thinkpads for 20 years. All of them very solid machines that just last and last, and never had a problem with running Linux on them

comment 7y ago · link · parent

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`.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

We're experimenting with Mermaid diagrams <https://mermaidjs.github.io/> in our source code. How does that come across?

comment 7y ago · link · parent

LOL

comment 7y ago · link · parent

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?

comment 7y ago · link · parent

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>

comment 7y ago · link · parent

The auto there works like a templated function would (except it's anonymous as you'd expect from a lambda).

comment 7y ago · link · parent

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 :-)

comment 7y ago · link · parent

Follow the link to the Gist <https://gist.github.com/KayEss/45a2e88675832228f57e2d598afc0... and your code editor should give you the comment folding you want.

comment 7y ago · link · parent

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 :-)

comment 7y ago · link · parent

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.

48.

Build me a Lisp(kirit.com ↗)

127 points · by KayEss · 7y ago · 68 comments

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

> 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.

comment 8y ago · link · parent

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>

comment 8y ago · link · parent

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.

comment 8y ago · link · parent

And then some idiots do a referendum and the state ends up voting itself out of the union?

comment 8y ago · link · parent

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.

comment 8y ago · link · parent

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.

comment 8y ago · link · parent

> 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.

comment 8y ago · link · parent

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.

comment 8y ago · link · parent

Central locking: if you're in the centre of the car yu can lock all the doors.

comment 8y ago · link · parent

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).

comment 8y ago · link · parent

Here in Bangkok the size of the (already legendary) traffic jams is certainly a great proxy for the economy as a whole.
1234567