[REBOL] returning an object from a function, sort of Re:
From: jelinem1:nationwide at: 17-Aug-2000 11:07
You were close. Drop the 'name argument and use the following syntax to
create your object:
I suppose you COULD keep the 'name argument, then use 'set within the
function to give this a value, but I use the example above to create my
objects. There are a couple more details to the argument approach; if you
really want to do things this way just ask and I'll spell it out.
- Michael Jelinek
[zoon--stumpworld--com] on 08/17/2000 10:36:41 AM
From: [zoon--stumpworld--com] on 08/17/2000 10:36 AM
Please respond to [list--rebol--com]
Subject: [REBOL] returning an object from a function, sort of
btw, I sent a message almost identical to this one from my home account
night, and it isn't here. Is it because the list doesn't rec that other
I've got a function called logo-factory that accepts a string argument, and
should return an object referenced by a word = the passed string. ie., if I
I should get the same result as if I typed
*Logo1: make object! [....]*
I'm befuddled as to how to do this exactly -- I'm sure the answer is right
my nose ;-)
Here's sort of what I have so far:
logo-factory: func [
"Creates and returns a named logo object."
name [string!] "The name of the object to be created."
????? make object! [
switch-type: func [
"Toggles the logo object's type between 'text' and 'pict'."
type: either type = "text" ["pict"]["text"]
Obviously, there's a lot missing here, like handling an argument string
can't be used as a valid word, etc. Other functions like get-pict and
write-html, etc., also need to be added.
Any and all suggestions are welcome!