Hi Ladislav

Are you basing your comments on assumptions? Or are you actually testing my
function !? I tried to follow your logic and - lo and behold - it works,
even though you claim it doesn't. 

In detail:

>Hi, Rebols, sending the version 3.0.0.0 of Methods,
>using some of Elan's suggestions (thx!).
>It look qiute nice, thx to Rebol.

Thanks for the compliments.


>
>To Elan: the nonreentrant version of ! doesn't work in the example written
>at the end of this.

Which "nonreentrant version of !" are you talking about? My version of !
certainly passes this trivial test. Am I overlooking something? This is
what I did?

a: make object! [
    num: 1
    methods: make object! [
        object: none
        get-num: func [] [object/num]
        sumnum: func [other [object!]] [ (do ! object  get-num) + 
                                         (do ! other get-num) 
        ]
    ]
]

b: make a [num: num + 1]

>> do ! a sumnum b
== 3
>> do ! b sumnum a
== 3
>>

It's working no? It's simpler. There are no problems. Why not use it?


>(Comment - your method of static storage is a "cheap currying", but it's got
>some problems...

Again these ominous "some problems". Which "some problems" are you
referring to? If the above example was expected to fail, I don't see that
it did.

>To be fair, my currying has some problems too - see curried functions
>thread, so i decided not to use currying, but instead hide the argument
>passing process under ! implementation)

If your currying has some problems, why not use the method I propose?

To remind you, this is my version of !:

!: func [object [object!] 'method ] [
  set in object/methods 'object object
  if error? try [return get in object/methods method] [return none]
]

Can you provide me with an example that demonstrates what you mean. (Oh,
and if I concur with my conclusions, please, please make sure that it
really does fail!)

Suspensefully yours,

Elan

Reply via email to