Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: objects and functions
Pages: [1] Print
Author Topic: objects and functions  (Read 485 times)
fhein
Newbie
*
Offline Offline

Posts: 47


View Profile
objects and functions
« on: June 07, 2005, 07:13:17 PM »

Code:
a: make object! [
 d: "some stuff"
 f: does [ print d ]
]

b: make a []

will the new object b contain a copy of the function a/f or just a pointer to the original function?

I hope I haven't asked this before and just forgot about the answer Tongue
Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
objects and functions
« Reply #1 on: June 08, 2005, 02:54:11 AM »

Going by this test of it done at the console...
Code:
>> a: make object! [
[     d: "some stuff"
[     f: does [ print d ]
[    ]
>>
>> b: make a []
>> x: get in a 'f
>> type? :x
== function!
>> y: get in a 'f
>> same? :x :y
== true
>> z: get in b 'f
>> same? :x :z
== false
it makes a new function.
Logged

- Carl Read
fhein
Newbie
*
Offline Offline

Posts: 47


View Profile
objects and functions
« Reply #2 on: June 08, 2005, 03:35:23 PM »

So to save some memory, I suppose I would have to
Code:
a: make object! [ d: "somestuff" ]
f: func [obj][ print obj/d ]

But that gets kinda awkward for longer functions with more descriptive names (which I ofcourse use Smiley). Do you know any ways I could improve my program regarding this matter?
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: objects and functions
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 11:37:08 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2287 Posts in 593 Topics by 3732 Members
Latest Member: Hentai40

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc