5 ms·
"In Skip the = operator introduces a new variable, but unlike other languages the = operator alone can not modify an existing variable." Using != to assign a v
by bbarn 5y ago
"In Skip the = operator introduces a new variable, but unlike other languages the = operator alone can not modify an existing variable."
Using != to assign a value feels really strange to me. I know some languages use := but in those languages typically it's because = is an equality operator. I'm sure there are some exceptions but != just so universally means "not equal" to me.
- sgillen 5y agoI too would prefer := or even =!
- asddubs 5y agoor <= which vhdl does (it differentiates between variables and signals so it uses both := and <=)
- samatman 5y agoWhat's stopped me from using this syntax in the past is that it means LTE in basically any language I can think of. One can certainly design a grammar where it's unambiguous, I have in fact, but it still doesn't look right to me.
- mst 5y agoR uses <- which is less ambiguous at the cost of no longer having an equals sign in it.
- Dylan16807 5y agoThat sounds like a benefit to me, not a cost.
- lostmsu 5y agoThat also means they have to use spaces? Otherwise what is the difference between x <- 1 and x < -1?
- janjones 5y agoBut it's not just `!=`, it is `!variable = value`, see [1]. That does not look like "not equal" operator. [1] http://skiplang.com/docs/lvalues.html http://skiplang.com/docs/lvalues.html
- mpweiher 5y agoObjective-S uses |= for one-way dataflow constraints, which you could also call "permanent assignment". http://objective.st/ http://objective.st/
- fjfaase 5y agoIt does make sense if you realize that it is also used for fields and that a.!b.c = d is different than a.b.!c = d. The first makes a copy of the object at a.b before assigning a new value to its field c.