News for hackers. Stuff that matters.
Re:Crabtime: Zig's Comptime in Rust by GrantMoyer on Saturday March 22, 2025 @01:46PM (#43447363)
Off the top of my head:

- There's both undefined and null

- There's three ways to declare variable

- typeof vs instanceof

- for in vs for of

- the way `this` works

- semantics of functions called with the wrong number of args

There's far more that I can't immediately recall.

Re:Crabtime: Zig's Comptime in Rust by throwawaymaths on Saturday March 22, 2025 @01:53PM (#43447406)
prototypes vs class
Re:Crabtime: Zig's Comptime in Rust by Lerc on Sunday March 23, 2025 @05:44AM (#43451869)
A lot of that is what I had in mind. Things like for...of and let fix glaring problems by introducing new things instead of changing to maintain backwards compatibility.

A lot of the fixes are just removing the old broken way of doing things.

I'd still probably change 'for x of ...' to implicitly be 'const x' and require let if you are doing shenanigans with changing the values.

I am surprisingly ok with null and undefined. Null means not a thing, undefined means there is not even the notion of the thing.

I'm pretty sure there are more than three ways to declare a variable.

    x=5
    let x=5
    var x=5
    window.x=5
    window["x"]=5   //arguably the same as above.
    Object.defineProperty(window,"x",{value:5}) 
    Object.assign(window,{x:5})
at least
Re:Crabtime: Zig's Comptime in Rust by paulddraper on Sunday March 23, 2025 @04:00PM (#43455445)
Many of those are setting properties, not variables.

A variable reference can lookup properties on the global object, or other objects with ‘with’

Re:Crabtime: Zig's Comptime in Rust by int_19h on Monday March 24, 2025 @06:07PM (#43465915)
> Null means not a thing, undefined means there is not even the notion of the thing.

If only "undefined" was consistently the same as lack of variable / collection entry, it would be understandable. But as things are, {x: 1, y: undefined} is not the same as {x: 1} in many ways - indeed, so much so that TS distinguishes between these two cases in its type system.

Re:Crabtime: Zig's Comptime in Rust by chuckadams on Sunday March 23, 2025 @08:49AM (#43452548)
And just for fun, `typeof null` returns `object`, which is an acknowledged bug they'll never fix because compatibility.
Re:Crabtime: Zig's Comptime in Rust by paulddraper on Sunday March 23, 2025 @03:56PM (#43455415)
> three ways to declare a variable

FWIW Python has three (default, nonlocal, and global).

And many languages have two.

Re:Crabtime: Zig's Comptime in Rust by codethief on Wednesday March 26, 2025 @01:14PM (#43484440)
> There's both undefined and null

To make matters even worse, there's a difference between setting an object property to undefined as opposed to omitting it. So one could say there are two different "undefined"s.