On 10/2/07, via RT Klaas-Jan Stol <[EMAIL PROTECTED]> wrote:
>
> # New Ticket Created by  Klaas-Jan Stol
> # Please include the string:  [perl #45935]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=45935 >
>
>
> hi,
>
> a code snippet like this:
>
> the_value = new 'Type'
> the_value = 42
>
> is in my eyes not clear. It seems as if the first line creates an object,
> and it seems to be discarded on the second line, as some value is assigned
> to the_value.
>
> some time ago (months, maybe > 1 year?) there was a discussion about
> different assignment operators for setting/assigning. I remember ":="
> being
> mentioned.
> I don't recall whether it was about the issue, or that it was about the
> ops
> "set" and "assign".
>
> I think this syntax could be improved, to make it more clear that the
> value
> 42 is assigned to the newly created object.
>
> kjs



as a note-to-self, maybe this is an idea:

.local pmc a,b,c
a = new 'Integer'
set a = 42

So, instead of "a=42", you need to use the op.
It reads kinda natural, "set a to 42", but it's a bit longer to type.

likewise, this could be done for "assign" as well
assign b = c

Also, the aforementioned ":=" could be introduced, like so:
a := new 'Integer' # assign a new object to a
a = 42 # set some value to a
a := b # assign value in b to a

I'm not really sure if assigning another pmc and creating a new pmc can both
be considered "assignment", thus using the ":=" assignment operator; in
other words, would this be more consistent?

Just some thoughts.
kjs

Reply via email to