Better HN
topnewbestaskshowjobs
Log inSign up

debugnik

2,570 karma · joined May 8, 2019 (7y ago) · 1,261 submissions

Submissions

comment 1y ago · link · parent

> Ada String is basically char array

Worse, the built-in Unicode strings are arrays of Unicode scalars, effectively UTF-32 in the general case. There's no proper way to write UTF-8 string literals AFAIK, you need to convert them from arrays of 8, 16 or 32 bit characters depending on the literal.

comment 1y ago · link · parent

Cloud should have been title-cased (they make this mistake almost every time in the article), they bought an FPGA decommissioned by Alibaba Cloud, the subsidiary.

comment 1y ago · link · parent

As much as I love F#, I wouldn't add it to a list of fast compilers; although I really appreciate that it supports actual file-scoped optimizations and features for compile-time inlining.

comment 1y ago · link · parent

You should have ordered them differently to not distract from your point: That most LLVM-based compilers do eventually need to write patches for it and usually ship them before upstreaming, they can't just use an existing release. I at least have always found that to be true to build such compilers from source.

comment 1y ago · link · parent

No? That's the other way around, ISPs blocking server IPs for customers. This is about servers blocking legally risky visitor IPs.

comment 1y ago · link · parent

In my experience, focus on community is how you get community drama in the first place.

comment 1y ago · link · parent

They didn't misunderstand, they're calling out Bevy's priorities.

Bevy is still incomplete as an engine. AFAIK there's only one commercially successful game made with it, Tiny Glade, and it doesn't even use Bevy's renderer but a custom one.

Yet the Bevy developers distract the project with essays and debates about the politics of their federated social media presence. You don't need that to build a game engine, but you do to build a "GITHUB OPEN SOURCE" game engine. I don't think there's anything inherently wrong with it, but that's clearly the focus here.

comment 1y ago · link · parent

> so a number of pattern can all be called "discriminated unions"

Assuming they've got discriminators and some sense of type union, sure.

> I just showed a data model with a discriminator (.Type)

Which won't let you recover the additional fields from a pointer because you can't downcast, so that's insufficient for a union. AFAIK you need to combine this with interfaces, which I already know how to do.

> These are largely irrelevant in a discussion about type embedding.

Don't tell me, you brought it up.

comment 1y ago · link · parent

You said struct embedding could be used for discriminated unions, but there's no mechanism to discriminate between union variants here.

comment 1y ago · link · parent

> And yes you should convert to OrderTypeA or OrderTypeB at the first opportunity in domain code,

Go can only downcast through interfaces so there's something missing to your approach to unions, isn't there?

comment 1y ago · link · parent

I think they meant games that specifically come with a sandboxed scripting layer. Otherwise, I agree that most mods are indeed just untrusted patches for a native executable or .NET assembly.

I guess the intent behind Cities Skylines's support for mods is just removing the need for a mod manager and enabling Steam Workshop support.

comment 1y ago · link · parent

> OCaml's newer Eio effect system

Eio is an IO library out of many competing ones, not OCaml's effect system. The capabilities are an Eio thing, not an effects thing.

comment 1y ago · link · parent

Something unclear about the explanation: systemd-inhibit is not running `sh & disown`, it's running `sh` and `& disown` applies to the systemd-inhibit command. If you actually daemonized the inner command, systemd-inhibit would release the lock immediately.

Cool trick though! I didn't know about systemd-inhibit.

comment 1y ago · link · parent

The footnote mentions they're stuck with 11ty's code highlighting plugin.

comment 1y ago · link · parent

> is the article an image!?

I can't check right now, but I'm guessing they set `user-select: none` in CSS.

comment 1y ago · link · parent

Last time I checked, about 5 years ago, the runtime libraries for the .NET target were a performance disaster. I remember reimplementing a compatible faster one in F#, but I wasn't satisfied with the overall program so I eventually got rid of ANTLR (and .NET) for that project altogether; I don't think the code survived.

comment 1y ago · link · parent

Isn't isOpen = false what triggers the transition in the first place here?

comment 1y ago · link · parent

I guess companies will pay for the cheapest copies for liability and then use the pirated dumps. Or just pretend that someone lent the books to them.

comment 1y ago · link · parent

Yes, the O in OCaml extends the type system with structurally typed objects and a classic OOP class system.

They're conceptually nice, specially the in-place object syntax, but the class syntax feels tacked on and the overall implementation is very naive compared to a proper OOP runtime like CLR/JVM/JS.

I suggest reaching for them only when first-class modules aren't enough (i.e. you need open recursion). Even then you could sometimes get away with polymorphic variant constraints, but that's admittedly harder to read and understand.

comment 1y ago · link · parent

I was just using Haskell's reputation to push back on the "as much type safety as python" hot take.

> [Haskell] doesn't provide a meaningful distinction between "This function might not return anything, and this is defined behavior" and "This function has a singularity"

I think Haskellers should fear divergence less, or push for SPARK-like static checking. In OCaml, the current trend would be to represent "not return anything" as None; and "has a singularity" by raising Invalid_argument or similar when the singularity check was considered a precondition, or returning Error (or an equivalent variant) for expected inputs.

Usage of Result in OCaml is also growing, thankfully. It's part of the stdlib, and we can use binding operators (let* foo = result) to do the same as ? in Rust (or let! in F#). OCaml 5.4 is even adding a Result.Syntax module so we can just open it instead of defining (let*) ourselves.

On the other hand, Result doesn't give us backtraces, and composes badly with other combinators or imperative flow. In my current project I'm instead giving a try to an effectul result_scope/get_ok API, which composes better.

comment 1y ago · link · parent

Yes, although they're replacements more than extensions. Stdlib is OCaml's builtin standard library, Base is Jane Street's lightweight replacement of Stdlib (although the most basic types are compatible), and Core is Jane Street's full standard library extending Base.

There's nothing inherently wrong with them, aside from their API being unstable, but they're an opinionated wedge in an ecosystem already lacking the cohesion of newer languages.

comment 1y ago · link · parent

> as much type safety as python

There's no type unsafety from unchecked exceptions, because uncaught exceptions are not unsound. Even Haskell has them (error and undefined), because from a theoretical standpoint they're equivalent to reaching an infinite loop. (Now, recovering from an exception isn't unsound either, but it might mess with your usual mutable invariants.)

In more practical terms, concerning overall correctness, OCaml has been adding option-returning variants of those functions, so most exceptions raised from the stdlib nowadays are much more likely to be intended by the author.

comment 1y ago · link · parent

> and a language that has large features that are almost soft discouraged

It's literally just objects, one large (and early!) feature. Arguably too large compared to the rest of the language: first-class modules or polymorphic variants can handle most of their use cases while being much simpler, and faster than the existing class system. (Objects and object types without the actual classes are maybe ok.)

The only other controversial feature I can think of is Seq and that's just because it can be allocation-heavy. Then again ordinary OCaml lists are not much cheaper (thankfully immutable arrays are already in for 5.4).

comment 1y ago · link · parent

My impression is that most people, as in a majority, aren't using Jane Street's Base and Core. Maybe some or even many, but not most, and specially not in the FOSS ecosystem. I think this idea comes from so many learning materials using their libs, you feel kind of funneled towards them at the start.

But yes, the standard library has added many helper functions that were sorely needed during the last few years, and the upcoming 5.4 keeps adding more. Still not as many goodies as Jane Street's libraries, but nowadays I don't miss them as long as I can use just a few small libraries, mostly by dbunzli and c-cube.

comment 1y ago · link · parent

You're missing the point, they're giving an example of an entire workload that fits into your technique's worst-case overhead. It's could be the right trade-off and rarely be hit, but that worst-case does sound bad.
1
212223
43