Search the web
Sign In
New User? Sign Up
iolanguage · Io
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 11910 - 11920 of 11920   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#11920 From: Steve Dekorte <steve@...>
Date: Thu Nov 26, 2009 6:44 am
Subject: Re: [Io] The "do" syntax
stevedekorte
Offline Offline
Send Email Send Email
 
On 2009-11-25, at 10:18 PM, bronxbomber92 wrote:

> Ahh. So this would be illegal?
>
> number := 1
> Foo = Object clone do (
>     bar := number
> )
>
> Btw, thanks for the quick reply!

That would work if number is in the Lobby (as Object inherits from Lobby) but
this wouldn't work:


test := method(
     number := 1
     Foo = Object clone do (
         bar := number
     )
)

test

#11919 From: "bronxbomber92" <bronxbomber92@...>
Date: Thu Nov 26, 2009 6:18 am
Subject: Re: [Io] The "do" syntax
bronxbomber92
Offline Offline
Send Email Send Email
 
Ahh. So this would be illegal?

number := 1
Foo = Object clone do (
      bar := number
)

Btw, thanks for the quick reply!

--- In iolanguage@yahoogroups.com, Steve Dekorte <steve@...> wrote:
>
>
> On 2009-11-25, at 9:12 PM, bronxbomber92 wrote:
>
> > I've seen the Object clone do ( ... ) syntax several times, but I don't see
any documentation on it.
> >
> > I can infer that code this:
> >
> > Foo := Object clone do (
> >    bar := 1
> >    baz := method(bar println)
> > )
> >
> > Is Functionally equivalent to this code?
> > Foo := Object clone
> > Foo bar := 1
> > Foo baz := method(bar println)
> >
> > Are there any other hidden semantics though?
>
> The difference is that the locals context of do() is the object it is being
called on - it doesn't have access to the locals in the scope that Object clone
do ( ... ) is called in.
>

#11918 From: Steve Dekorte <steve@...>
Date: Thu Nov 26, 2009 5:36 am
Subject: Re: [Io] The "do" syntax
stevedekorte
Offline Offline
Send Email Send Email
 
On 2009-11-25, at 9:12 PM, bronxbomber92 wrote:

> I've seen the Object clone do ( ... ) syntax several times, but I don't see
any documentation on it.
>
> I can infer that code this:
>
> Foo := Object clone do (
>    bar := 1
>    baz := method(bar println)
> )
>
> Is Functionally equivalent to this code?
> Foo := Object clone
> Foo bar := 1
> Foo baz := method(bar println)
>
> Are there any other hidden semantics though?

The difference is that the locals context of do() is the object it is being
called on - it doesn't have access to the locals in the scope that Object clone
do ( ... ) is called in.

#11917 From: "bronxbomber92" <bronxbomber92@...>
Date: Thu Nov 26, 2009 5:12 am
Subject: The "do" syntax
bronxbomber92
Offline Offline
Send Email Send Email
 
I've seen the Object clone do ( ... ) syntax several times, but I don't see any
documentation on it.

I can infer that code this:

Foo := Object clone do (
     bar := 1
     baz := method(bar println)
)

Is Functionally equivalent to this code?
Foo := Object clone
Foo bar := 1
Foo baz := method(bar println)

Are there any other hidden semantics though?

Thanks,
Jedd

#11916 From: Rich Collins <richcollins@...>
Date: Wed Nov 25, 2009 6:26 am
Subject: Ioke
richwcollins
Offline Offline
Send Email Send Email
 
(http://blip.tv/file/2229292/) 25:30 is interesting

Question:

"Usually when someone creates a new language they have something in
mind that they didn't find in another language.  Why did you write Ioke"

Answer:

"I wanted to see if the focus on performance in other languages was
one of the problems with them.  The goal is expressiveness. ... Ioke
is a language that I created only for me."

  From http://www.iolanguage.com/scm/git/checkout/Io/docs/IoGuide.html

"The focus of programming language research for the last thirty years
has been to combine the expressive power of high level languages like
Smalltalk and the performance of low level language like C with little
attention paid to advancing expressive power itself. The result has
been a series of languages which are neither as fast as C or as
expressive as Smalltalk. Io's purpose is to refocus attention on
expressiveness by exploring higher level dynamic programming features
with greater levels of runtime flexibility and simplified programming
syntax and semantics."

#11915 From: Mike Austin <mike_ekim@...>
Date: Sun Nov 15, 2009 8:41 am
Subject: Re: self == Lobby in activate()?
mike_ekim
Offline Offline
Send Email Send Email
 
Steve Dekorte wrote:
> On 2009-11-14, at 10:35 AM, Mike Austin wrote:
>  > I changed it to use block() and I do see different behavior -
>  > nothing happens
>  > at all now :)
>
> A block has to be called with the "call" method. I think what you want
> is:
>
> Test := Object clone do(
> init := method(
> self setIsActivatable(true)
> )
> activate := method(
> writeln(self == Lobby)
> ) setScope(thisContext)
> )
> test := Test clone
> test

Thanks Steve, it's working.  I'm playing around with state driven code, and it
seems like it can be done:

Buffer := Object clone do(
    full := clone

    init := method(
      self buffer := list()
      self setIsActivatable(true)

      self activate := method(
        if (buffer size > 2, self setProto(full))
        self
      ) setScope(thisContext)
    )

    put := method(value,
      writeln("Buffer put()")
      buffer append(1, 3, 3)
    )

    full put := method(value,
      writeln("Buffer full put()")
    )
)

buffer := Buffer clone
buffer put("abc")
buffer put("abc")

Mike

>

#11914 From: Steve Dekorte <steve@...>
Date: Sat Nov 14, 2009 10:22 pm
Subject: Re: [Io] Re: self == Lobby in activate()?
stevedekorte
Offline Offline
Send Email Send Email
 
On 2009-11-14, at 10:35 AM, Mike Austin wrote:
> I changed it to use block() and I do see different behavior -
> nothing happens
> at all now :)

A block has to be called with the "call" method. I think what you want
is:

Test := Object clone do(
    init := method(
      self setIsActivatable(true)
    )
    activate := method(
      writeln(self == Lobby)
    ) setScope(thisContext)
)
test := Test clone
test

#11913 From: Mike Austin <mike_ekim@...>
Date: Sat Nov 14, 2009 6:35 pm
Subject: Re: self == Lobby in activate()?
mike_ekim
Offline Offline
Send Email Send Email
 
Jeremy Tregunna wrote:
>
>
> This is the way method dispatch works. your test message is found in the
> Lobby, and since the Lobby can get to Object's definition of
> isActivatable and Lobby doesn't have its own, it finds it on Object, but
> since it's a method, it's dynamically scoped so self points at the
> Lobby. Change activate to a block and you'll see different behaviour.

I changed it to use block() and I do see different behavior - nothing happens
at all now :)

Test := Object clone do(
    init := method(
      self setIsActivatable(true)
    )
    activate := block(
      writeln(self == Lobby)
      self
    )
)
test := Test clone
test

> On 2009-11-14, at 2:58 AM, Mike Austin wrote:
>
>  > I'm a little confused as to why self == Lobby in a new object's
> activate() slot:
>  >
>  > Test := Object clone do(
>  > init := method(
>  > self setIsActivatable(true)
>  > )
>  > activate := method(
>  > writeln(self == Lobby)
>  > )
>  > )
>  > test := Test clone
>  > test
>  >
>  > Any ideas? I'm using a recent git download, but it says Io 20090105 (??)
>  >
>  > Mike
>  >
>  >
>  >
>  > ------------------------------------
>  >
>  > Yahoo! Groups Links
>  >
>  >
>  >
>
> Regards,
>
> Jeremy Tregunna
> jeremy.tregunna@... <mailto:jeremy.tregunna%40me.com>
>
>

#11912 From: Jeremy Tregunna <jeremy.tregunna@...>
Date: Sat Nov 14, 2009 8:02 am
Subject: Re: [Io] self == Lobby in activate()?
jeremy.tregunna@...
Send Email Send Email
 
This is the way method dispatch works. your test message is found in the Lobby,
and since the Lobby can get to Object's definition of isActivatable and Lobby
doesn't have its own, it finds it on Object, but since it's a method, it's
dynamically scoped so self points at the Lobby. Change activate to a block and
you'll see different behaviour.

On 2009-11-14, at 2:58 AM, Mike Austin wrote:

> I'm a little confused as to why self == Lobby in a new object's activate()
slot:
>
> Test := Object clone do(
>   init := method(
>     self setIsActivatable(true)
>   )
>   activate := method(
>     writeln(self == Lobby)
>   )
> )
> test := Test clone
> test
>
> Any ideas?  I'm using a recent git download, but it says Io 20090105 (??)
>
> Mike
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

Regards,

Jeremy Tregunna
jeremy.tregunna@...

#11911 From: Mike Austin <mike_ekim@...>
Date: Sat Nov 14, 2009 7:58 am
Subject: self == Lobby in activate()?
mike_ekim
Offline Offline
Send Email Send Email
 
I'm a little confused as to why self == Lobby in a new object's activate() slot:

Test := Object clone do(
    init := method(
      self setIsActivatable(true)
    )
    activate := method(
      writeln(self == Lobby)
    )
)
test := Test clone
test

Any ideas?  I'm using a recent git download, but it says Io 20090105 (??)

Mike

#11910 From: Steve Dekorte <steve@...>
Date: Wed Nov 4, 2009 9:27 am
Subject: Re: [Io] New website design
stevedekorte
Offline Offline
Send Email Send Email
 
On 2009-11-03, at 11:31 PM, Justin Poliey wrote:
> The only thing I'm not a huge fan of is the mouseover effect

I've changed it to use an underline - thanks.

Messages 11910 - 11920 of 11920   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help