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.


Updated 25-Jun-2024 - Edit - Copyright REBOL Technologies -