News for hackers. Stuff that matters.
Re:Show HN: Buzz, strongly typed scripting language written ... by teux on Monday November 21, 2022 @09:26AM (#33692801)
Makes sense, and I guess it’s semantics, but if the language/interpreter is handling which numeric types to use for me, should it really be sold as “strongly typed” in the main tagline for the language?

Internally, float and int are completely different types, 2’s compliment vs ieee754. Conglomerating them to a “number” feels like weak typing.

(Disclaimer: I’m a grumpy C++ engineer.)

Edit: it does look like a neat/useable language though!

Re:Show HN: Buzz, strongly typed scripting language written ... by lolinder on Monday November 21, 2022 @10:28AM (#33693618)
Typing is technically a distinct concept from binary representation, it just happens to be a very useful concept for interpreting bits. If the set of valid operations is known at compile time with no exceptions, I'd call that strong typing regardless of whether the internal representation changes during execution.

The problem I do see with combining int and float is that it means that you always have to be careful with == on any pair of numbers, where a language that does distinguish between the two gives you a cue about when equality will work and when it won't.

But that's a flaw in the number type, not a weakness in the type system.

Re:Show HN: Buzz, strongly typed scripting language written ... by 1MachineElf on Monday November 21, 2022 @10:51AM (#33693906)
I will be interesting to see how this combined number data type plays with the Zig/CPP/C interop feature: https://github.com/buzz-language/buzz#call-czig-code
Re:Show HN: Buzz, strongly typed scripting language written ... by teux on Tuesday November 22, 2022 @05:19AM (#33704154)
Thanks, yeah that makes a lot of sense. I do tend to conflate the two concepts.
Re:Show HN: Buzz, strongly typed scripting language written ... by kroltan on Monday November 21, 2022 @10:33AM (#33693679)
Those are representations, not types. I think they are using the "what can I do with this" definition of type, which is just its public API, and nominality (walks like a duck, quacks like a duck, doesn't mean it's a duck)
Re:Show HN: Buzz, strongly typed scripting language written ... by incrudible on Monday November 21, 2022 @12:14PM (#33695047)
They are not ducks, they are two different animals, even if you disregard binary representation.
Re:Show HN: Buzz, strongly typed scripting language written ... by nicoburns on Monday November 21, 2022 @12:33PM (#33695319)
It may be strong typing, and there are just no ints. This is how JavaScript works: all numbers are f64.
Re:Show HN: Buzz, strongly typed scripting language written ... by postalrat on Monday November 21, 2022 @12:46PM (#33695491)
Then what is: 1 << 33
Re:Show HN: Buzz, strongly typed scripting language written ... by nicoburns on Monday November 21, 2022 @01:14PM (#33695841)
Hmm... it's 2. It seems that the bitwise operators do indeed convert numbers into 32 bit integers (truncating any decimal parts) before applying their operation.