Re: Assignment Operators

Kurtis Rainbolt-Greene <[email protected]> Wed, 16 May 2012 01:59:05 -0500
Newsgroups gmane.comp.lang.io
Message-ID <CAMhJPGhENX+ms-qddH6WCp5ejdvSt=YP9Q6HtpvkiKa0EmEqrg@mail.gmail.com>
That's a great question, and I considered talking about it in the original
post but wanted to gauge interest first.

My first reaction is to up the :'s. Example:

``` io
slot_with_setter::: "initial value"

slot:: "value"

slot: "value"
```
I'm not sure I like that syntax, however.

Which brings me to this: Does Io even need an operator for updateSlot? I
assume the updateSlot method exists to save CPU cycles, as you can "update"
a slot via setSlot.

On Wed, May 16, 2012 at 1:50 AM, Steve Dekorte <[email protected]> wrote:

> **
>
>
>
> Hi Kurtis,
>
> An interesting idea. Self did something like this IIRC and I liked it,
> though it fit in with their Smalltalk infix syntax better.
> The motivation of using = was to graphically show the connection between
> =, := and ::=.
> If we used : for := and :: for ::=, what would we use for =? Would it
> remain the same?
>
> Steve
>
>
> On 2012-05-15 Tue, at 11:21 PM, Kurtis Rainbolt-Greene wrote:
>
> > So I've been using Io for a bit now, writing a package manager,
> > writing a few packages. I even wrote a syntax definition file for
> > Sublime Text 2.
> >
> > One thing I've noticed since writing that defintion file is that it
> > doesn't seem like Io needs the "=" character in the assignment
> > operators.
> >
> > Consider the following:
> >
> > ``` io
> > Version := Object clone do(
> > major ::= 0
> > minor ::= 0
> > patch ::= 0
> >
> > asString := method( "#{major}.#{minor}.#{patch}" )
> > )
> > ```
> >
> > Pretty simple object, right? Now imagine if you didn't need the `=`
> characters.
> >
> > ``` io
> > Version: Object clone do(
> > major:: 0
> > minor:: 0
> > patch:: 0
> >
> > asString: method( "#{major}.#{minor}.#{patch}" )
> > )
> > ```
> >
> > Smaller, slightly easier to read, and no confusion with the `==`,
> > `!=`, `+=`, `-=`, `>=`, `<=`, `~=`, `&=`, or `||=` operators that
> > usually crop up in programming languages.
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>  
>