If blocks are objects why can't they be stored literally in arrays: 
Author Message
 If blocks are objects why can't they be stored literally in arrays:

For example

    #( 1  2  [ ] )

Things get weird with:

    Array with: 1 with: 2 with: []



Mon, 06 Dec 2004 03:42:56 GMT  
 If blocks are objects why can't they be stored literally in arrays:

Quote:
> For example

>     #( 1  2  [ ] )

> Things get weird with:

>     Array with: 1 with: 2 with: []

In Smalltalk/X the former seems to fail as a matter of syntax. I can
accept that.

The latter works fine. What was supposed to happen?

--
/ Peter Schuller, InfiDyne Technologies HB




-----------== Posted via Newsfeeds.Com - Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Ulimited Fast Downloads - 19 Servers =-----



Mon, 06 Dec 2004 03:56:19 GMT  
 If blocks are objects why can't they be stored literally in arrays:
On Wed, 19 Jun 2002 15:42:56 -0400, "John Small"

Quote:

>For example

>    #( 1  2  [ ] )

A block is not a literal. Only literals are allowed in a litreral
array.

Quote:
>Things get weird with:
>    Array with: 1 with: 2 with: []

Nothing weird with the above in Dolphin. See test below.

ar:=Array with: 1 with: 2 with: [] with: [1+1].

(ar at: 3) value.  answers--> nil

(ar at: 4) value.  answers --> 2

This may look weird but its just the display.

ar at: 4.   answres --> ar:=Array with: 1 with: 2 with: [] with:
[1+1].

(ar at: 3) value.

(ar at: 4) value.

Costas



Mon, 06 Dec 2004 09:20:17 GMT  
 If blocks are objects why can't they be stored literally in arrays:
Hi Pete,

Array with: 1 with: 2 with: []

in Dolphin 5  XP produces:

    #(1 2 Array with: 1 with: 2 with: [])

which looks like some kind of recursive mumbo jumbo because

    (Array with:1 with: 2 with: []) at: 3

yields itself:

    (Array with:1 with: 2 with: []) at: 3

I think the block closure is confused.

Any way I have abandon my design attempt at pseudo virtual function
(block) tables.

Thanks!

John


Quote:
> > For example

> >     #( 1  2  [ ] )

> > Things get weird with:

> >     Array with: 1 with: 2 with: []

> In Smalltalk/X the former seems to fail as a matter of syntax. I can
> accept that.

> The latter works fine. What was supposed to happen?

> --
> / Peter Schuller, InfiDyne Technologies HB




> -----------== Posted via Newsfeeds.Com - Uncensored Usenet News
==----------
>    http://www.newsfeeds.com       The #1 Newsgroup Service in the World!
> -----= Over 100,000 Newsgroups - Ulimited Fast Downloads - 19 Servers

=-----


Mon, 06 Dec 2004 22:31:37 GMT  
 If blocks are objects why can't they be stored literally in arrays:
I stand corrected.  Costas is right - thank you for this clarification!

John


Quote:
> On Wed, 19 Jun 2002 15:42:56 -0400, "John Small"

> >For example

> >    #( 1  2  [ ] )

> A block is not a literal. Only literals are allowed in a litreral
> array.

> >Things get weird with:
> >    Array with: 1 with: 2 with: []

> Nothing weird with the above in Dolphin. See test below.

> ar:=Array with: 1 with: 2 with: [] with: [1+1].

> (ar at: 3) value.  answers--> nil

> (ar at: 4) value.  answers --> 2

> This may look weird but its just the display.

> ar at: 4.   answres --> ar:=Array with: 1 with: 2 with: [] with:
> [1+1].

> (ar at: 3) value.

> (ar at: 4) value.

> Costas



Mon, 06 Dec 2004 22:34:51 GMT  
 If blocks are objects why can't they be stored literally in arrays:
I stand corrected.  Pete and Costas are right - thank you for this
clarification!

John


Quote:
> Hi Pete,

> Array with: 1 with: 2 with: []

> in Dolphin 5  XP produces:

>     #(1 2 Array with: 1 with: 2 with: [])

> which looks like some kind of recursive mumbo jumbo because

>     (Array with:1 with: 2 with: []) at: 3

> yields itself:

>     (Array with:1 with: 2 with: []) at: 3

> I think the block closure is confused.

> Any way I have abandon my design attempt at pseudo virtual function
> (block) tables.

> Thanks!

> John



> > > For example

> > >     #( 1  2  [ ] )

> > > Things get weird with:

> > >     Array with: 1 with: 2 with: []

> > In Smalltalk/X the former seems to fail as a matter of syntax. I can
> > accept that.

> > The latter works fine. What was supposed to happen?

> > --
> > / Peter Schuller, InfiDyne Technologies HB




> > -----------== Posted via Newsfeeds.Com - Uncensored Usenet News
> ==----------
> >    http://www.newsfeeds.com       The #1 Newsgroup Service in the World!
> > -----= Over 100,000 Newsgroups - Ulimited Fast Downloads - 19 Servers
> =-----



Mon, 06 Dec 2004 22:39:11 GMT  
 If blocks are objects why can't they be stored literally in arrays:

Quote:

> Any way I have abandon my design attempt at pseudo virtual function
> (block) tables.

John

If you want to implement something like that, why don't you simply store the
blocks in a Dictionary? I've done that a number of times. Of course, try to
make sure that they're clean blocks too.
--
Joseph Pelrine [ | ]
MetaProg GmbH

Web:   http://www.metaprog.com

"If you don't live on the edge, you're taking up too much space" -
Doug Robinson



Tue, 07 Dec 2004 01:22:25 GMT  
 If blocks are objects why can't they be stored literally in arrays:
John,

Quote:
> Array with: 1 with: 2 with: []

> in Dolphin 5  XP produces:

>     #(1 2 Array with: 1 with: 2 with: [])

> which looks like some kind of recursive mumbo jumbo because

>     (Array with:1 with: 2 with: []) at: 3

> yields itself:

>     (Array with:1 with: 2 with: []) at: 3

> I think the block closure is confused.

This effect is actually related to another thread (Block Source - a question
by Bill Schwab). Whenever an evaluation is compiled in a workspace it builds
an instance of CompiledExpression. The evaluation source is written into the
change log by the compiler and the CompiledExpression source pointer points
to the chunk where this is. Any blocks inside the CompiledExpression hold a
back-pointer to their context (in this case the CompiledExpression) and they
access their source from there. Unfortunately, the block doesn't hold any
additional information that identifies which section of the
CompiledExpression's full source represents the source for the block. Hence,
when a block reports its source it can only provide the full text of the
CompiledExpression that contains it.

Does this make it any clearer what is going on? Basically, the block is okay
but it's presentation is a bit screwy.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---



Tue, 07 Dec 2004 01:38:50 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. I am not deaf, but am I mute?

2. The Smalltalk Store: Why we've been slow, and why we're getting better

3. 'who am i' from unix

4. Why am I getting bind errors?

5. ERROR 48 - Why am I getting it?

6. why am i getting processor stack fault error?

7. Why I am not enthusiatic about OO COBOL

8. Why I am (core) dumping C++ for OOCOBOL

9. Why am I getting a NaN?

10. Why am I creating named fonts if....

11. Anybody know why I am timing out

12. Why I am not reaching callbacks ?

 

 
Powered by phpBB® Forum Software