Re: vote on assignments as expressions
Laurent Dube <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Organization | DEI |
| Message-ID | <[email protected]> |
Mark Hahn wrote:
> So we need an alternative syntax like "a <- b", but I don't want to use that
> for all assignments because "a = b" is so common. Once again familiarity
> beats logic.
The desired sequence of actions being
a = b
foo( a )
you propose to add a binary operator to the language
foo( a operator b)
that would allow to combine the two actions while respecting their
sequence.
An easy way out would be to use a function instead of an operator:
foo( a.assign!(b) )
where assign in place is the functional equivalent of the familiar
operator version of the same action.
It's familiar, no new operator to learn, the sequencing is automatic,
and it doesn't need to beat any logic.
#1) I do WANT this feature in Prothon.
#2) I prefer the following syntax: a.assign!(b)
Laurent Dube