Re: Difference between method and block - with examples

Tiogshi Laj <[email protected]>
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
That doesn't work because := creates a new slot with that binding if one
doesn't exist in lexical scope. You want to use just = there in order to
assign to the inherited slot instead of creating a new one.

(( Tiogshi Laj :: Average ASCII Artisan And Ambitiously Anachronistic
Assonanteur ))
(( This email has been quad-ROT13 encrypted. Reading it violates the DMCA.
))
(( Now with 50% more fuit jruice! Ask about our convenient bulk pricing! ))
(( 我说很少的汉语,还我的语法平庸, but at least I'm UNICODE-compliant. ))


On Sun, Jun 12, 2011 at 4:34 PM, Shashank <[email protected]> wrote:

>
>
>
> Hi Oscar,
>
>
> --- In [email protected], Oscar Martinez <wasi.network@...>
> wrote:
> >
> > >
> > Hi Shashank,
> >
> > blk call(2)
> >
>
> Perfect! Thanks!!
>
> Now, am I to assume that the way blocks differ from methods is this:
>
> n := 10
> mthd := method(i, i + n)
> mthd(2) # No need to "call"
>
> I must have mis-understood then. I thought "method" was a dynamic closure
> and was expecting this to work too:
>
> foo := method(n := 20,mthd(2))
> foo # should return 22 but returns 12
>
> No?
>
> - Shashank
>
>  
>
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.