News for hackers. Stuff that matters.
Re:Type system of Fortnite's Verse language by Asooka on Thursday March 30, 2023 @08:33AM (#35371642)
Programming languages have settled on '=' for assignment and '==' for equality comparison. Teaching people non-standard syntax because you think it might be easier is just doing them a disservice. Everyone I know that started with Pascal was mostly pissed that they didn't learn a language actually used in industry and had to re-learn the syntax. It's not like mathematical notation is intuitive in some way either - humanity needed several thousand years before we came up with something ergonomic, plus '=' is used for assignment in math just as often too. At least I do not know of any mathematician who uses ':=' to denote assigning a value to a name.
Re:Type system of Fortnite's Verse language by nequo on Thursday March 30, 2023 @09:20AM (#35372255)
Most programming languages but not all. Three prominent examples are Pascal which you mention, OCaml, and the POSIX `test`/`[` command which all use `=` for equality. (More specifically, for structural equality, in the case of OCaml.)

More intuitive to complete beginners and definitely not unheard of.

In mathematics, I have seen both `:=` and `\equiv` for assignment. But Go and Pascal also use `:=`. Of these, I would consider Go quite widely used in the industry.

Re:Type system of Fortnite's Verse language by IshKebab on Thursday March 30, 2023 @11:25AM (#35374156)
Go only uses := for declare & assign. For simple assignment it's =, and equality is still ==. So I would say it is barely different to the norm.

POSIX `[` is clearly insane so let's ignore that.

Which leaves Pascal and OCaml both of which are quite niche.

I think he's right. It's definitely not worth going against the grain with this syntax, and it's debatable if it's even that bad in isolation. I seriously doubt beginners struggle with it.

Re:Type system of Fortnite's Verse language by nequo on Thursday March 30, 2023 @04:42PM (#35378565)
This is textbook bikeshedding. If you have a bias for C syntax, everything else will look niche, weird, or "clearly insane" to you. But there's no reason that we should prefer C's syntactic decisions for assignment and equality operators in a non-C language. Go itself deviated from them, and the authors were instrumental to C itself.
Re:Type system of Fortnite's Verse language by IshKebab on Thursday March 30, 2023 @05:29PM (#35379049)
> But there's no reason that we should prefer C's syntactic decisions for assignment and equality operators in a non-C language.

Yes there is - because almost every language uses the same convention, and it's a totally reasonable one. You have to have a really good reason to go against that and I don't see one.

> Go itself deviated from them

Go didn't deviate from the C convention. It just added an extra shorthand operator to simultaneously declare and initialise variables. The meanings of `=` and `==` are the same in Go as in C.

> or "clearly insane" to you

I wasn't saying the use of `=` for equality is clearly insane. `[` is clearly insane for other reasons.

Re:Type system of Fortnite's Verse language by joshspankit on Thursday March 30, 2023 @12:17PM (#35375109)
You’ve picked a poor example. ‘=‘, ‘==‘, and ‘===‘ constantly trip up new coders and have led to some not-insignificant bugs.

A lot of style guides even had to include guards against the worst one:

‘if (variable = “string”)’

I think that putting guardrails there by making the assignment operator stand out was a smart move. Annoying to use, but smart.

Re:Type system of Fortnite's Verse language by grumpyprole on Thursday March 30, 2023 @01:36PM (#35376363)
> Programming languages have settled on '=' for assignment and '==' for equality comparison.

Certainly not all. "=" is a poor choice for assignment as it has a totally different meaning in maths. Algol and Pascal got this right with ":=". Fortran got it wrong here.

> plus '=' is used for assignment in math just as often too

No it's a relational operator in math, so "x = x + 1" does not have the same meaning as assignment to a mutable variable.

Re:Type system of Fortnite's Verse language by Animats on Thursday March 30, 2023 @03:56PM (#35378038)
In functional languages, you seldom replace an existing value. Verse, like Rust, is mostly single-assignment.
Re:Type system of Fortnite's Verse language by firstlink on Saturday April 01, 2023 @04:00AM (#35398232)
In Verse there's no such thing as equality comparison. Assignment is the only thing that = does.If you want to do something if two things are equal, you attempt the assignment and whether this is logically consistent with the rest of the program determines whether the other things are executed.