[vwnc] can anyone post the result of the following doit?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] can anyone post the result of the following doit?

Eliot Miranda-2
Hi,

    quick request.  Please post to the list so people can see who responded and there be only one response :)

I'd like to see the output of:


| col |
col := OrderedCollection new.
1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].
Array with: (col collect: [ :each | each value ]) asArray
with: thisContext method symbolic

TIA
Eliot

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

Boris Popov, DeepCove Labs (SNN)

#(2 3 4 5 6 7 8 9 10 11 12)

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda
Sent: Wednesday, July 22, 2009 11:19 AM
To: vwnc NC
Subject: [vwnc] can anyone post the result of the following doit?

 

Hi,

 

    quick request.  Please post to the list so people can see who responded and there be only one response :)

 

I'd like to see the output of:

 

 

            | col |

            col := OrderedCollection new.

            1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].

            Array with: (col collect: [ :each | each value ]) asArray

                        with: thisContext method symbolic

 

TIA

Eliot


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Eliot Miranda-2

D’oh.

 

1:  #(2 3 4 5 6 7 8 9 10 11 12)

2:  'normal AnnotatedMethod numArgs=0 numTemps=1 frameSize=12

 

literals: ({OrderedCollection} CompiledBlock [] in UndefinedObject>>unboundMethod #to:do: {Array} BlockClosure [] in UndefinedObject>>unboundMethod #method #symbolic )

 

1 <34> push OrderedCollection

2 <BC> send new

3 <4C> store local 0; pop

4 <4A> push 1

5 <D8 0B> push 11

7 <10> push local 0

8 <FA 01 01> make copying block (1)

11 <CC 42> no-check send to:do:

13 <66> pop

14 <37> push Array

15 <10> push local 0

16 <20> push BlockClosure [] in UndefinedObject>>unboundMethod

17 <F0 4C> send collect:

19 <F0 9B> send asArray

21 <54> push context

22 <75> send method

23 <76> send symbolic

24 <F0 4A> send with:with:

26 <65> return

'

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: Boris Popov
Sent: Wednesday, July 22, 2009 11:28 AM
To: 'Eliot Miranda'; vwnc NC
Subject: RE: [vwnc] can anyone post the result of the following doit?

 

#(2 3 4 5 6 7 8 9 10 11 12)

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda
Sent: Wednesday, July 22, 2009 11:19 AM
To: vwnc NC
Subject: [vwnc] can anyone post the result of the following doit?

 

Hi,

 

    quick request.  Please post to the list so people can see who responded and there be only one response :)

 

I'd like to see the output of:

 

 

            | col |

            col := OrderedCollection new.

            1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].

            Array with: (col collect: [ :each | each value ]) asArray

                        with: thisContext method symbolic

 

TIA

Eliot


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

Jason Rogers-4
In reply to this post by Eliot Miranda-2
 #(#(2 3 4 5 6 7 8 9 10 11 12) 'normal AnnotatedMethod numArgs=0
numTemps=1 frameSize=12

literals: ({OrderedCollection} CompiledBlock [] in
UndefinedObject>>unboundMethod #to:do: {Array} BlockClosure [] in
UndefinedObject>>unboundMethod #method #symbolic )

1 <34> push OrderedCollection
2 <BC> send new
3 <4C> store local 0; pop
4 <4A> push 1
5 <D8 0B> push 11
7 <10> push local 0
8 <FA 01 01> make copying block (1)
11 <CC 42> no-check send to:do:
13 <66> pop
14 <37> push Array
15 <10> push local 0
16 <20> push BlockClosure [] in UndefinedObject>>unboundMethod
17 <F0 4C> send collect:
19 <F0 9B> send asArray
21 <54> push context
22 <75> send method
23 <76> send symbolic
24 <F0 4A> send with:with:
26 <65> return
')

>From a 7.5NC vanilla image.

On Wed, Jul 22, 2009 at 2:18 PM, Eliot Miranda<[hidden email]> wrote:

> Hi,
>     quick request.  Please post to the list so people can see who responded
> and there be only one response :)
> I'd like to see the output of:
>
> | col |
> col := OrderedCollection new.
> 1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].
> Array with: (col collect: [ :each | each value ]) asArray
> with: thisContext method symbolic
> TIA
> Eliot
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



--
Jason Rogers

"I am crucified with Christ: nevertheless I live;
yet not I, but Christ liveth in me: and the life
which I now live in the flesh I live by the faith of
the Son of God, who loved me, and gave
himself for me."
    Galatians 2:20

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

thomas.hawker
In reply to this post by Boris Popov, DeepCove Labs (SNN)

Interesting.

 

Well, my non-Smalltalk background is showing.  I would have expected the value of the block “[ i ]” to hold the value of ‘i’ at the point of reference, not the point of evaluation.  I recognized that each activation context gives ‘i’ a unique state (which is retained because of the copying block involved).  This seems to have something similar to “pass by name” semantics, which uses the current value at the time of invocation.

 

I wonder what would happen if you had multiple blocks involved, some of which set ‘i’, and multiple invocations that retrieve ‘i’.  This seems to be a very confusing way to set anonymous semi-persistent state…

 

Cheers!

 

Tom Hawker

Senior Framework Developer

Home

+1 (408) 274-4128

The Environment:

We take it personally

Office

+1 (408) 576-6591

Mobile

+1 (408) 835-3643

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Wednesday, July 22, 2009 11:29 AM
To: Boris Popov; Eliot Miranda; vwnc NC
Subject: Re: [vwnc] can anyone post the result of the following doit?

 

D’oh.

 

1:  #(2 3 4 5 6 7 8 9 10 11 12)

2:  'normal AnnotatedMethod numArgs=0 numTemps=1 frameSize=12

 

literals: ({OrderedCollection} CompiledBlock [] in UndefinedObject>>unboundMethod #to:do: {Array} BlockClosure [] in UndefinedObject>>unboundMethod #method #symbolic )

 

1 <34> push OrderedCollection

2 <BC> send new

3 <4C> store local 0; pop

4 <4A> push 1

5 <D8 0B> push 11

7 <10> push local 0

8 <FA 01 01> make copying block (1)

11 <CC 42> no-check send to:do:

13 <66> pop

14 <37> push Array

15 <10> push local 0

16 <20> push BlockClosure [] in UndefinedObject>>unboundMethod

17 <F0 4C> send collect:

19 <F0 9B> send asArray

21 <54> push context

22 <75> send method

23 <76> send symbolic

24 <F0 4A> send with:with:

26 <65> return

'

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: Boris Popov
Sent: Wednesday, July 22, 2009 11:28 AM
To: 'Eliot Miranda'; vwnc NC
Subject: RE: [vwnc] can anyone post the result of the following doit?

 

#(2 3 4 5 6 7 8 9 10 11 12)

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda
Sent: Wednesday, July 22, 2009 11:19 AM
To: vwnc NC
Subject: [vwnc] can anyone post the result of the following doit?

 

Hi,

 

    quick request.  Please post to the list so people can see who responded and there be only one response :)

 

I'd like to see the output of:

 

 

            | col |

            col := OrderedCollection new.

            1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].

            Array with: (col collect: [ :each | each value ]) asArray

                        with: thisContext method symbolic

 

TIA

Eliot

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

Eliot Miranda-2
Hi Thomas,

    (forgive the repost; I always get gmail reply/reply all wrong)

On Wed, Jul 22, 2009 at 11:54 AM, <[hidden email]> wrote:

Interesting.

 

Well, my non-Smalltalk background is showing.  I would have expected the value of the block “[ i ]” to hold the value of ‘i’ at the point of reference, not the point of evaluation.  I recognized that each activation context gives ‘i’ a unique state (which is retained because of the copying block involved).  This seems to have something similar to “pass by name” semantics, which uses the current value at the time of invocation.

 

I wonder what would happen if you had multiple blocks involved, some of which set ‘i’, and multiple invocations that retrieve ‘i’.  This seems to be a very confusing way to set anonymous semi-persistent state…


And you expect an instance variable to have the value it had at instance creation time also? ;)  There is, as Vassili has pointed out many time, a deep correspondence between objects and closures.  You'd be miffed if an object shared between clients didn't reflect the changes in state made by those different clients right?  It wouldn't be an object if it didn't.  The fact that i is a variable means its value should be that of its most recent assignment.  i := i + 1 is the most recent assignment.  You've seen the following many times, right?

incrementBlock
    | counter |
    counter := -1.
    ^[counter := counter + 1]

and there's no surprise that

    (1 to: 10) collect: self counterBlock

answers 0 through 9 right? 

 

Cheers!

 

Tom Hawker

Senior Framework Developer

Home

+1 (408) 274-4128

The Environment:

We take it personally

Office

+1 (408) 576-6591

Mobile

+1 (408) 835-3643

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Wednesday, July 22, 2009 11:29 AM
To: Boris Popov; Eliot Miranda; vwnc NC
Subject: Re: [vwnc] can anyone post the result of the following doit?

 

D’oh.

 

1:  #(2 3 4 5 6 7 8 9 10 11 12)

2:  'normal AnnotatedMethod numArgs=0 numTemps=1 frameSize=12

 

literals: ({OrderedCollection} CompiledBlock [] in UndefinedObject>>unboundMethod #to:do: {Array} BlockClosure [] in UndefinedObject>>unboundMethod #method #symbolic )

 

1 <34> push OrderedCollection

2 <BC> send new

3 <4C> store local 0; pop

4 <4A> push 1

5 <D8 0B> push 11

7 <10> push local 0

8 <FA 01 01> make copying block (1)

11 <CC 42> no-check send to:do:

13 <66> pop

14 <37> push Array

15 <10> push local 0

16 <20> push BlockClosure [] in UndefinedObject>>unboundMethod

17 <F0 4C> send collect:

19 <F0 9B> send asArray

21 <54> push context

22 <75> send method

23 <76> send symbolic

24 <F0 4A> send with:with:

26 <65> return

'

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: Boris Popov
Sent: Wednesday, July 22, 2009 11:28 AM
To: 'Eliot Miranda'; vwnc NC
Subject: RE: [vwnc] can anyone post the result of the following doit?

 

#(2 3 4 5 6 7 8 9 10 11 12)

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda
Sent: Wednesday, July 22, 2009 11:19 AM
To: vwnc NC
Subject: [vwnc] can anyone post the result of the following doit?

 

Hi,

 

    quick request.  Please post to the list so people can see who responded and there be only one response :)

 

I'd like to see the output of:

 

 

            | col |

            col := OrderedCollection new.

            1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].

            Array with: (col collect: [ :each | each value ]) asArray

                        with: thisContext method symbolic

 

TIA

Eliot

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] can anyone post the result of the following doit?

thomas.hawker
In reply to this post by thomas.hawker

Eliot,

 

(Don’t worry about the repost.)

 

And as for Vassili, the fact that a variable’s value should be that of its most recent assignment is only partially true here.  There is a question of state semantics, which has been sidestepped.  The critical concept is whether the block “[ i ]” references state at the context of definition or the context of evaluation.  Although it’s been a long time, I think Ada forced this issue out in the open with the distinction between definition, declaration, elaboration, and evaluation.  We can all agree here that BlockClosures and BlockContexts implement this as context of evaluation.

 

I don’t have a particular issue with the results – they’re just not what I would have assumed.  As I said, it’s my non-Smalltalk background showing.  I hadn’t ever really thought through the implications.  I’m certain I’ve programmed something like this sometime in the past, but offhand can’t recall when or where.

 

It’s something to remember, anyway…  J

 

Cheers!

 

Tom Hawker

Senior Framework Developer

Home

+1 (408) 274-4128

The Environment:

We take it personally

Office

+1 (408) 576-6591

Mobile

+1 (408) 835-3643

 


From: Eliot Miranda [mailto:[hidden email]]
Sent: Wednesday, July 22, 2009 12:01 PM
To: THOMAS HAWKER (IRIS2-ISD-OOCLL/SNT)
Subject: Re: [vwnc] can anyone post the result of the following doit?

 

 

On Wed, Jul 22, 2009 at 11:54 AM, <[hidden email]> wrote:

Interesting.

Well, my non-Smalltalk background is showing.  I would have expected the value of the block “[ i ]” to hold the value of ‘i’ at the point of reference, not the point of evaluation.  I recognized that each activation context gives ‘i’ a unique state (which is retained because of the copying block involved).  This seems to have something similar to “pass by name” semantics, which uses the current value at the time of invocation.

I wonder what would happen if you had multiple blocks involved, some of which set ‘i’, and multiple invocations that retrieve ‘i’.  This seems to be a very confusing way to set anonymous semi-persistent state…

And you expect an instance variable to have the value it had at instance creation time also? ;)  There is, as Vassili has pointed out many time, a deep correspondence between objects and closures.  The fact that i is a variable means its value should be that of its most recent assignment.  i := i + 1 is the most recent assignment.  You've seen the following many times, right?

 

incrementBlock

    | counter |

    counter := -1.

    ^[counter := counter + 1]

 

and there's no surprise that

 

    (1 to: 10) collect: self counterBlock

 

answers 0 through 9 right?

 

Cheers!

 

Tom Hawker

Senior Framework Developer

Home

+1 (408) 274-4128

The Environment:

We take it personally

Office

+1 (408) 576-6591

Mobile

+1 (408) 835-3643

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Wednesday, July 22, 2009 11:29 AM
To: Boris Popov; Eliot Miranda; vwnc NC
Subject: Re: [vwnc] can anyone post the result of the following doit?

 

D’oh.

 

1:  #(2 3 4 5 6 7 8 9 10 11 12)

2:  'normal AnnotatedMethod numArgs=0 numTemps=1 frameSize=12

 

literals: ({OrderedCollection} CompiledBlock [] in UndefinedObject>>unboundMethod #to:do: {Array} BlockClosure [] in UndefinedObject>>unboundMethod #method #symbolic )

 

1 <34> push OrderedCollection

2 <BC> send new

3 <4C> store local 0; pop

4 <4A> push 1

5 <D8 0B> push 11

7 <10> push local 0

8 <FA 01 01> make copying block (1)

11 <CC 42> no-check send to:do:

13 <66> pop

14 <37> push Array

15 <10> push local 0

16 <20> push BlockClosure [] in UndefinedObject>>unboundMethod

17 <F0 4C> send collect:

19 <F0 9B> send asArray

21 <54> push context

22 <75> send method

23 <76> send symbolic

24 <F0 4A> send with:with:

26 <65> return

'

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: Boris Popov
Sent: Wednesday, July 22, 2009 11:28 AM
To: 'Eliot Miranda'; vwnc NC
Subject: RE: [vwnc] can anyone post the result of the following doit?

 

#(2 3 4 5 6 7 8 9 10 11 12)

 

-Boris

 

--

+1.604.689.0322

DeepCove Labs Ltd.

4th floor 595 Howe Street

Vancouver, Canada V6C 2T5

http://tinyurl.com/r7uw4

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Eliot Miranda
Sent: Wednesday, July 22, 2009 11:19 AM
To: vwnc NC
Subject: [vwnc] can anyone post the result of the following doit?

 

Hi,

 

    quick request.  Please post to the list so people can see who responded and there be only one response :)

 

I'd like to see the output of:

 

 

            | col |

            col := OrderedCollection new.

            1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].

            Array with: (col collect: [ :each | each value ]) asArray

                        with: thisContext method symbolic

 

TIA

Eliot

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.

 

IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not
intended for you, please delete it immediately unread.  The internet
cannot guarantee that this communication is free of viruses, interception
or interference and anyone who communicates with us by email is taken
to accept the risks in doing so.  Without limitation, OOCL and its affiliates
accept no liability whatsoever and howsoever arising in connection with
the use of this email.  Under no circumstances shall this email constitute
a binding agreement to carry or for provision of carriage services by OOCL,
which is subject to the availability of carrier's equipment and vessels and
the terms and conditions of OOCL's standard bill of lading which is also
available at http://www.oocl.com.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc