Hi, Rebols,
Something like:
!: func [
object [object!]
'method [word!]
/local mth
] [
; let's skip error checking for clarity
mth: get in object/methods method
bind second :mth in object 'self
return :mth
]
;text skipped
a: make object! [
num: 1
On 4-Dec-1999/10:39:46-5:00, [EMAIL PROTECTED] wrote:
Is it possible to make a sound (like a beep) from REBOL?
You can make REBOL speak on the Amiga, but unfortunately this isn't very
cross-platform...just a luxury provided by the AmigaOS.
I believe REBOL/media will be able (eventually) to make
Hi Ladislav,
you wrote,
Ciao, Gabriele,
to the best of my knowledge, Ciao translates to something like goodbye. ;-)
- a nice idea. The problem here is that this approach is static, i.e.
non-re-entrant, because it uses only static storage for object parameter,
namely the code block of method, so
Is it possible to make a sound (like a beep) from REBOL?
Or how about a groan from everyone in re off-topic messages?
Russell [EMAIL PROTECTED]
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 04, 1999 8:39 AM
Subject: [REBOL] Objects: Preventing Code Duplication Re:(11)
Is it possible to make
Hi Ladislav,
I wrote:
(Oh,
and if I concur with my conclusions, please, please make sure that it
really does fail!)
Read: (Oh, and if YOU concur ... )
Am I being a little self-centered here? ;-)
Sorry,
Elan
Once again Hi Ladislav,
I believe I've figured ou why you think my function should have problems
with reentrancy.
You see that my function sets the object word of the methods object of the
object it is passed. Therefore, whatever ! is doing, it relies on the
expectation that the methods/object
Hi, Elan
you wrote:
Hi Ladislav,
I wrote:
(Oh,
and if I concur with my conclusions, please, please make sure that it
really does fail!)
Read: (Oh, and if YOU concur ... )
Am I being a little self-centered here? ;-)
Sorry,
Elan
-
I was so sure, it would fail I didn't test it and
Hi Ladislav,
you wrote:
-
Of course, it works.
But try to rewrite the code like this:
sumnum: func [other [object!]] [ (do ! other get-num) +
(do ! self get-num)
and see what happens
---
Do you realize that REBOL supplies
[EMAIL PROTECTED] wrote:
At 12:48 PM 12/1/99 +0100, you wrote:
[EMAIL PROTECTED] wrote:
It uses use
contexts:
To avoid problems with the garbage collector, my hide.r show work
fine here.
Mmm... show = should.
Hi Gabriele, what is hide.r and where do I get it?
I posted it here. I
Hi, Elan,
I see your point to use Rebol argument passing. Your idea is quite
interesting, i didn't even think about it, because it seemed too complicated
to me.
The problem is, that if you use the static storage for an argument,
you are making another source of ugly bugs - the method calls are
Hi Elan,
my point I wanted to state was: if both 'probe s are the same
you can't use the probe to show that it's not duplicated, am I
right?
regards
Ingo
Those were the words of [EMAIL PROTECTED]:
Hi Ingo,
yes, you do get the same probe because the use context is hidden both in
the
At 10:24 PM 12/1/99 +0100, you wrote:
Hi Elan,
my point I wanted to state was: if both 'probe s are the same
you can't use the probe to show that it's not duplicated, am I
right?
Absolutely.
Elan
regards
Ingo
Those were the words of [EMAIL PROTECTED]:
Hi Ingo,
yes, you do get the same
Hi Gabriele,
thanks.
At 01:53 PM 12/2/99 +0100, you wrote:
[EMAIL PROTECTED] wrote:
At 12:48 PM 12/1/99 +0100, you wrote:
[EMAIL PROTECTED] wrote:
It uses use
contexts:
To avoid problems with the garbage collector, my hide.r show work
fine here.
Mmm... show = should.
Hi
Elan wrote:
-
The
following mechanism can be used to avoid inheriting some code. It uses use
contexts:
ancestor: make object! [
do-something: none
use [var-1 var-1 comment {more vars here} func-1 func-2 func-3 ] [
var-1: "this is var-1"
var-2: "this is var-2"
;- more
Hi Ladislav,
you wrote:
There are two problems with your solution:
a) it is relying on the persistence of func-1, func-2, ..., which is not
garanteed now (problem with indefinite extent and garbage collector...)
Where do you take that from? func-1 and func-2 are both referenced by
do-something,
At 12:48 PM 12/1/99 +0100, you wrote:
[EMAIL PROTECTED] wrote:
It uses use
contexts:
To avoid problems with the garbage collector, my hide.r show work
fine here.
Hi Gabriele, what is hide.r and where do I get it?
Elan
Hi, Elan. You wrote:
Hi Ladislav,
I like what you did here. What it does not do, is prevent code duplication.
-
It really does, see later...
-
I copied the stuff as you wrote it into the REBOL console and added one
more, important expression after creating the object 'b:
b: make a
Hi, Elan, you wrote:
I copied the stuff as you wrote it into the REBOL console and added one
more, important expression after creating the object 'b:
b: make a [num: num + 1]
This additional expression was probe b
probe b
make object! [
num: 2
messages:
make object! [
Hi Ladislav,
you wrote:
We have gained a lot. CF:
no-copying: same? get in a 'message get in b 'message
==true
no-copying: same? get in a/message 'get-num get in b/message 'get-num
==true
I see what you mean. I'd call it a bug ... When objects are inherited,
objects they contain should not be
20 matches
Mail list logo