ALGOL 68 has the nice property that there are no variables/lvalues: There are names that are bound to constant values, and there are values that are addresses. "int x := 5" is shorthand for stack-allocating an int and binding x to its address (so the type of x is "ref int").
-
Show this thread
-
This seems much nicer than lvalues, which are probably much more complicated than most people think. The trouble is that dereferencing everything would be very annoying syntactically. ALGOL 68 solves that by implicitly coercing "ref t" to "t". I don't really like that.
2 replies 0 retweets 0 likesShow this thread -
For example, if you write "f(x)" in C, you know that x is being passed by value. If you write "f(x)" with implicit dereferencing, you can't tell without knowing the types. There are some other potential ambiguities. Is there a better solution to this?
1 reply 0 retweets 0 likesShow this thread -
Replying to @shachaf
Those are the three sane designs: all values constant but there are pointers you can read or write; both constant and mutable values but you can only copy or pass mutable as pointers by taking addresses; and const+mutable+references+pointers.
2 replies 0 retweets 1 like -
Replying to @TimSweeneyEpic
It's pretty odd that an lvalue is "a thing with an address" and a pointer is "the address of a thing". They're two views on the same thing but it works surprisingly well. Algol 68 has automatic dereferencing which seems worrying to me, but manual dereferencing gets cumbersome.
2 replies 0 retweets 0 likes
Automatic derefencing of explicit reference types only works sanely in languages lacking generic types. With generics, a type parameter could either by int or int ref, and things like equality would become ambiguous (comparing values or addresses?) And then there’s int ref ref.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.