REBOL 3.0

Comments on: Datatype conversions that make sense

Carl Sassenrath, CTO
REBOL Technologies
23-Aug-2008 21:12 GMT

Article #0142
Main page || Index || Prior Article [0141] || Next Article [0143] || 5 Comments || Send feedback

With so many built-in datatypes, there are many choices for what types of native conversions to support and which ones are meaningless.

Last week I wrote a line of code that did this:

word: make word! state

where state was a logic value, either TRUE or FALSE.

Of course, it threw an error, and I used a different method. Not a big deal really, but it seemed to me that the code should have been allowed.

So, yesterday, I added it... a single line change and it now works just fine.

But, here's the question: when it comes to such conversions, which do we want to support natively? Some conversions make a lot of sense, others are useless, and we shouldn't bother with them.

Or reworded as a question to you as developers: what conversions are we lacking that are a problem for you?

For example, a couple weeks ago I wrote:

obj: make object! map-val

Where map-val was of type map! The conversion is not supported, so I made it:

obj: make object! to-block map-val

but, that creates an extra block and performs a needless reduction (evaluation) of the block. So, here again, the direct conversion seems useful.

Personally, I think we need to make a list of "desired conversions" that we can prioritize, then add them, up to a limit.

5 Comments

Comments:

Brian Hawley
23-Aug-2008 21:16:08
There should definitely be a conversion from map! to object!, and that makes more sense than converting it to block at all. Semantically there is little difference between map! and object! right now.
Henrik
24-Aug-2008 4:08:24
I don't know which types are supposed to be convertible, but I do know that Docbase will need a nice big table of those conversion possibilities. It's ok to experiment in the console to get a specific conversion working, but sometimes, a table would make it easier to see if something obvious is missing.

The table could be autogenerated. OK, back to topic. :-)

Gregg Irwin
25-Aug-2008 14:45:45
Would have helped me recently in fact. I thought [to time! none] would throw an error, but it produces 0:00.
Carl Sassenrath
25-Aug-2008 15:14:30
Ok, thanks for the input.

Also, DocBase does have some nice big tables... thanks to a script by Gregg. Of course, we (main rebolers) need to look over the results and make some decisions.

Maarten
26-Aug-2008 2:09:29
This is also typically a 3.1 improvement?

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0142


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 29-Mar-2024 - Edit - Copyright REBOL Technologies - REBOL.net