Re: NULL value anyone?

new topic     » goto parent     » topic index » view thread      » older message » newer message
_tom said...

How does the eu:object function recognize that a variable does not have an assigned value?

Internally, OE has a special value called NOVALUE, which is defined as 0xbfffffffL on 32bit and 0xbfffffffffffffff on 64bit. This is basically used the way you describe NULL as being used. If someone attempts to use a variable, and it's value is NOVALUE, the interpreter assumes that the variable was not initialized and calls RTFatal.

object() just makes the check against NOVALUE and returns 0 instead of calling RTFatal.

_tom said...

Given an object "x" with an assigned value, how may it be reverted back to "does not have an assigned value"?

Not sure if this is possible today. One might need to modify the interpreter to do this - but inside the interpreter it's simple. Just set the variable back to NOVALUE.

_tom said...

Why doesn't Euphoria have a NULL value for an object?

A NULL value could be useful when a function returns results where {} or 0 are legal values for an algorithm.

_tom

I don't know the answer to this. It's been like this since the RobC days.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu