Re: Re: vote on := for assignments and in expressions

Mukhsein Johari <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
--- Laurent Dube <[email protected]> wrote: > 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.

Me too. = being used in python (and C) was always a
pet peeve for me. (maybe because I learnt pascal
before C? :-/). This would make for:

:= for assignments (takes on/points to value?)
== for 'have same value' test
!= for 'not have same value' test

While we're at it, is = or == better for the
conditional test? I've got a slight preference for =
since this is what's used in math.

> 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

I think not. In this case, y and z are not assigned
the values 11 and 12. Maybe:

def func(x, y:11, z:12):
    pass

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

I think when calling,

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

is more consisent as this is a real 'assign value to
varname' (or point varname to value if you prefer)

> How is that not be interpreted as assigning a value
> to local variable y
> and then passing that value to the first argument x?

I thought we aren't implemeting assignment as
expression? (I am AGAINST that btw.)

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html
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.