Re: vote on := for assignments and in expressions

"Mark Hahn" <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
"Laurent Dube" <[email protected]> wrote in message
news:[email protected]...
> Mark Hahn wrote:
>
>  > Since using := for assignment everywhere was not a choice in the
original
>  > voting, I want to start a new vote on that issue.  Please vote FOR or
>  > AGAINST changing the symbol = to := for the assignment statement and
>  > allowing it to be used in expressions also.
>
> I'm FOR changing the symbol = to := for the assignment statement.
>
> I'm FOR allowing it to be used in expressions also.
> It's not my style to use it, but the meaning will remain clear
>
> Now, check this out. How about function defs and function calls?
> Do we use ":=" for defaults?
>
>    def func(x, y:=11, z:=12)  # with default values

Yes, the default is a real assignment even if it is conditional.

> What do we use for keyword-matched arguments in function calls?
>
>    func(y = 1, z = 2, x = 3)

A keyword isn't an assignment, it is a labeling specification.  To be most
exact it is a key,value pair like in a dictionary construction, so
technically it should be a colon, not an equals sign.

    func(y: 1, z: 2, x: y := 3)

We can discuss this further if the vote goes through.
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.