Re: Minor syntax improvements (proposal)

Carl Gay <[email protected]>
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CALekcH25PAORT-W6oMHn51JiyLn6eaz84wqi-xLhm0Y07zy=sg@mail.gmail.com>
On Thu, Feb 28, 2013 at 7:42 AM, Luis Pedrero <[email protected]> wrote:

> Hi
>
> sensing from the recent emails that there is some chance for
> language-changing proposals to be accepted, or at least to be taken
> into serious consideration (which does not happen in every language
> community), I gathered the courage to venture some small proposals of
> my own.
> Not much of a contribution, to be sure, and only pertaining to
> superficial aspects of the language.
>

Any contribution is more than welcome!  But I have to point out that your
two proposals aim to change the language in fairly fundamental ways,
whereas adding new string syntax would be fairly minor since no existing
code would be broken.


>
> 1) allow the use of the keyword "local" (in addition/substitution to
> "let") to define a local variable. The word let, in itself, does not
> convey any meaning on locality, and in theory could also apply (for
> those who are not familiar with the language) to any type of variable.
> So it is a bit misleading, or at least not so much useful. The keyword
> local is much better, because it is self-explanatory.
>

I think "let" is fairly obvious (at least for nerdy English speakers)
because it is used verbally in math and has a history in many programming
languages.  Plus, it saves two characters, and who can argue with that‽

This is interesting though.  We do already have a "local" reserved word for
introducing local methods.
http://opendylan.org/books/drm/Functions_Overview#IX-771  But why is it
separate from "let"?  I dunno!  F# uses "let" for both.  Here are the three
syntaxes:

local method m() #t end;
let var = val;
let handler <error> = method(cond, next) ... end;

I wonder why they didn't use "let method true() #t end" instead.


>
> 2) Simplify the syntax of assignment operators, for the sake of
> consistency and simplicity. In all cases where an assignment is taking
> place, I propose that only one operator should be used.
> I fail to see the reason why = is used at all, in addition to :=
> I am probably missing something, but the point is: whatever the
> rationale for using =, i.e. yet another operator, in addition to :=,
> is this really justified in terms of economy of the language? I am not
> talking only in terms of compiler economy, but also in terms of
> programmer's mental economy... In sum, it would be much simpler to
> have only one assignment operator, and := is of course the best
> choice, because it is not ambiguous, whereas = is commonly used by
> many programmers for equality testing.
>

Honestly not sure on this one.  Conceptually "let x" is different from
assignment since it's creating a new binding, but that's not very
convincing.  I think this change would be a step sideways at best though.


>
> These two improvements will add to the readability of the language, I
> believe.
>
> Regards,
>
> Luis
>

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.