[p-dev] Variable scoping
Gert Meulyzer
info at gertm.eu
Tue May 21 00:18:54 AEST 2019
My thoughts on this:
On Mon, May 20, 2019 at 2:03 PM Paul Bone <paul at bone.id.au> wrote:
>
> if (...) {
> x = ...
> } else {
> x = ...
> }
> print!(x) % We can use x here.
>
> This is indeed not what you expect for this kind of syntax.
All other languages that have this syntax will throw you an error.
People will indeed expect this to be the case.
The main counter-proposal I have is:
>
> var x
> if (...) {
> x = ...
> } else {
> x = ...
> }
> print!(x) % We can use x here.
>
>
> Good: Familiar
>
👍
Bad: More verbose than necessary
>
More verbose, yes, but perhaps more clear what is happening.
Interesting: "var" is a weird keyword for something that doesn't vary. But
> I think here's where we make another pragmatic choice and do
> call them variables.
>
Why not call them 'val' then? As in values?
There are languages that do this. (Scala, iirc)
That makes it super clear, but not sure if this is 'in theme' for the
current Plasma vocabulary?
Gert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://plasmalang.org/list-archives/dev/attachments/20190520/6caefe19/attachment.html>
More information about the dev
mailing list