Re: Assignment Operators

Jan-Paul Bultmann <[email protected]> Wed, 16 May 2012 10:23:21 +0200
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
It is there so that you can easily update Object members.
Take for example the following.

A := Object clone do(
	x := 5
	nonlocal := method(
		x = 10
		)
	
	local := method(
		x := 10
		)

First case you assigned `A x` a new value.
Second case you created a local variable.

Cheers Jan

On May 16, 2012, at 8:21 AM, 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.
>