About object!s and custom datatypes
[1/6] from: hallvard::ystad::oops-as::no at: 2-Jan-2005 21:15
Hello Gabriele et al.,
I tried to use custom-types.r to make my own datatype, but it didn't work, because some
of Ladislavs subfunc-stuff crashed somehow. But here's a more theoretical question:
I was considering turning my url-object (http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?color=yes&script=url-handler.r)
into a datatype for the RIX. I thought that would make way for clearer code. Some of
the comparisons I do with URLs take place in a method inside the object. Instead of
site1/equal? site2
I would like to write
equal? site1 site2
like with basic datatypes like string!s and integer!s. The question is: Would this slow
rebol down? What are the most important advantages and disadvantages of making one's
own datatypes?
I can think of this, for a start:
I have, in the 'equal? func, refinements like /regard-section and /regard-cgi-order.
I guess these cannot be brought into the 'equal? action? Or is this not so?
I find the idea of custom datatypes interesting. Please enlighten me on it's (dis)advantages.
Regards,
HY
[2/6] from: lmecir:mbox:vol:cz at: 3-Jan-2005 10:55
Hi Hallvard,
>Hello Gabriele et al.,
>
>I tried to use custom-types.r to make my own datatype, but it didn't work,
> because some of Ladislavs subfunc-stuff crashed somehow
>
happy New Year to you and to all. I tried to write a new version of
pass-args and didn't test the changed Subfunc. Try the version
http://www.fm.vslib.cz/~ladislav/rebol/subfunc.r that I posted now.
-L
[3/6] from: gabriele:colellachiara at: 3-Jan-2005 12:04
Hi Hallvard,
On Sunday, January 2, 2005, 9:15:34 PM, you wrote:
HY> I tried to use custom-types.r to make my own datatype, but it didn't work,HY> because
some of Ladislavs subfunc-stuff crashed somehow. But here's a moreHY> theoretical question:
That's the downside of experimental code. ;) If you are using the
YourValues version (which is very different from my original
version), note that it is developed on the latest alphas.
HY> site1/equal? site2
HY> I would like to write
HY> equal? site1 site2
HY> like with basic datatypes like string!s and integer!s. The question is:HY> Would
this slow rebol down? What are the most important advantages andHY> disadvantages of
making one's own datatypes?
Replacing all the actions slows down REBOL noticeably. That's why
I don't do that anymore (only the first version of custom-types.r
did that). What I do is create new actions that can handle custom
types. I.e.:
equal?* site1 site2
The starred actions work on "normal" types too.
The disadvantage is that you might end up with more complications
than simplifications. :)
HY> I can think of this, for a start:
HY> I have, in the 'equal? func, refinements like /regard-section andHY> /regard-cgi-order.
I guess these cannot be brought into the 'equal? action?HY> Or is this not so?
You'd need a different "action". (The point of having "your own
datatype", IMHO, is that of following the standard interface of
all the other datatypes, so that you don't have to learn a new
API.) You could use EQUAL? and STRICT-EQUAL? but I guess that's
not enough for you.
This would need to be solved differently, design-wise...
HY> I find the idea of custom datatypes interesting. Please enlighten me on it'sHY>
(dis)advantages.
Sometimes having the same API for everything is a great advantage,
other times it's just a complication...
I guess this is not the answer you wanted to hear. :)
Regards,
Gabriele.
--
Gabriele Santilli <g.santilli-tiscalinet.it> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[4/6] from: hallvard:ystad:oops-as:no at: 3-Jan-2005 13:18
Thanks, but...
** Script Error: sub has no value
** Where: subfunc
** Near: sub context
HY
Dixit Ladislav Mecir (10.55 03.01.2005):
[5/6] from: lmecir::mbox::vol::cz at: 3-Jan-2005 13:40
Hallvard Ystad napsal(a):
>Thanks, but...
>
>** Script Error: sub has no value
>** Where: subfunc
>** Near: sub context
>
>HY
>Dixit Ladislav Mecir (10.55 03.01.2005):
>
Hello, that is exactly the "feature" that has been solved by the update,
use Rebol to read the recent file.
-L
[6/6] from: lmecir::mbox::vol::cz at: 3-Jan-2005 13:50
Ladislav Mecir napsal(a):
>Hallvard Ystad napsal(a):
>>Thanks, but...
<<quoted lines omitted: 12>>
>use Rebol to read the recent file.
>-L
another option is to get it here:
http://www.compkarori.com/vanilla/display/subfunc.r&calendar-year=2002&calendar-month=12
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted