inline evaluation of conditionals

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

inline evaluation of conditionals

stefano-franchi
Can anyone explain why this expression:

(aNumber >= anotherNumber) and: [aBoolean]

is perfectly fine, but its permutation:

  aBoolean and: [aNumber >= anotherNumber]

throws a VM-generated error?

I banged my head hard, but can't find out. Must be too thick.

S.




__________________________________________________
Stefano Franchi
Department of Philosophy                  Ph:  (64) 9 373-7599 x83940
University Of Auckland Fax: (64) 9 373-7408
Private Bag 92019 [hidden email]
Auckland
New Zealand

Reply | Threaded
Open this post in threaded view
|

Re: inline evaluation of conditionals

Cesar Rabak
Stefano Franchi escreveu:

> Can anyone explain why this expression:
>
> (aNumber >= anotherNumber) and: [aBoolean]
>
> is perfectly fine, but its permutation:
>
>  aBoolean and: [aNumber >= anotherNumber]
>
> throws a VM-generated error?
>
> I banged my head hard, but can't find out. Must be too thick.
>
Can you send more details?

The permutations above work perfectly in a Workspace in VW7.3.1nc and
VW7.4nc.


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

Reply | Threaded
Open this post in threaded view
|

Re: inline evaluation of conditionals

Carl Gundel
In reply to this post by stefano-franchi
> Can anyone explain why this expression:
>
> (aNumber >= anotherNumber) and: [aBoolean]
>
> is perfectly fine, but its permutation:
>
>   aBoolean and: [aNumber >= anotherNumber]
>
> throws a VM-generated error?
>
> I banged my head hard, but can't find out. Must be too thick.

What's the error?  Does it happen at compile-time or execution-time?

One thought: If aBoolean is not an instance of Boolean the first expression
will execute without error, but the second expression will throw "NonBoolean
receiver".  Is that what you're seeing?

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com


Reply | Threaded
Open this post in threaded view
|

Re: inline evaluation of conditionals

James Robertson-3
In reply to this post by stefano-franchi
I tried, and could not reproduce your problem.  Can you give a specific
example that fails?

At 08:50 AM 5/7/2006, you wrote:

>Can anyone explain why this expression:
>
>(aNumber >= anotherNumber) and: [aBoolean]
>
>is perfectly fine, but its permutation:
>
>  aBoolean and: [aNumber >= anotherNumber]
>
>throws a VM-generated error?
>
>I banged my head hard, but can't find out. Must be too thick.
>
>S.
>
>
>
>
>__________________________________________________
>Stefano Franchi
>Department of Philosophy                  Ph:  (64) 9 373-7599 x83940
>University Of Auckland                  Fax: (64) 9 373-7408
>Private Bag 92019                               [hidden email]
>Auckland
>New Zealand

<Talk Small and Carry a Big Class Library>
James Robertson, Product Manager, Cincom Smalltalk
http://www.cincomsmalltalk.com/blog/blogView

Reply | Threaded
Open this post in threaded view
|

Re: inline evaluation of conditionals

stefano-franchi

On May 12, 2006, at 2:27 AM, James Robertson wrote:

> I tried, and could not reproduce your problem.  Can you give a
> specific example that fails?
>
> At 08:50 AM 5/7/2006, you wrote:
>> Can anyone explain why this expression:
>>
>> (aNumber >= anotherNumber) and: [aBoolean]
>>
>> is perfectly fine, but its permutation:
>>
>>  aBoolean and: [aNumber >= anotherNumber]
>>
>> throws a VM-generated error?
>>
>> I banged my head hard, but can't find out. Must be too thick.
>>
>> S.
>>
>>
>>
>>
>> __________________________________________________
>> Stefano Franchi
>> Department of Philosophy                  Ph:  (64) 9 373-7599 x83940
>> University Of Auckland                  Fax: (64) 9 373-7408
>> Private Bag 92019                              
>> [hidden email]
>> Auckland
>> New Zealand
>
> <Talk Small and Carry a Big Class Library>
> James Robertson, Product Manager, Cincom Smalltalk
> http://www.cincomsmalltalk.com/blog/blogView
>
>
__________________________________________________
Stefano Franchi
Department of Philosophy                  Ph:  (64)  9 373-7599 x83940
University Of Auckland Fax: (64) 9 373-8768
Private Bag 92019 [hidden email]
Auckland
New Zealand

Reply | Threaded
Open this post in threaded view
|

Re: inline evaluation of conditionals

stefano-franchi
In reply to this post by James Robertson-3
Hi James,

    it was actually an embarrassing mistake of mine: I didn't realize I
had initialized aBoolean to True instead of true (i.e class instead of
instance). Then of course I would not get the error when aBoolean was
inside the block because it was never evaluated. As I said,
embarrassing...



Cheers,

Stefano


On May 12, 2006, at 2:27 AM, James Robertson wrote:

> I tried, and could not reproduce your problem.  Can you give a
> specific example that fails?
>
> At 08:50 AM 5/7/2006, you wrote:
>> Can anyone explain why this expression:
>>
>> (aNumber >= anotherNumber) and: [aBoolean]
>>
>> is perfectly fine, but its permutation:
>>
>>  aBoolean and: [aNumber >= anotherNumber]
>>
>> throws a VM-generated error?
>>
>> I banged my head hard, but can't find out. Must be too thick.
>>
>> S.
>>
>>
>>
>>
>> __________________________________________________
>> Stefano Franchi
>> Department of Philosophy                  Ph:  (64) 9 373-7599 x83940
>> University Of Auckland                  Fax: (64) 9 373-7408
>> Private Bag 92019                              
>> [hidden email]
>> Auckland
>> New Zealand
>
> <Talk Small and Carry a Big Class Library>
> James Robertson, Product Manager, Cincom Smalltalk
> http://www.cincomsmalltalk.com/blog/blogView
>
>
__________________________________________________
Stefano Franchi
Department of Philosophy                  Ph:  (64)  9 373-7599 x83940
University Of Auckland Fax: (64) 9 373-8768
Private Bag 92019 [hidden email]
Auckland
New Zealand