Re: Very First Language to Learn: Phix or Euphoria?
- Posted by katsmeow Apr 17, 2018
- 2474 views
ifdef is like C's #if and that's the problem. It is a very uninspired way of doing things. It would be much better if we could just query directly whether something exists or not:
In C, it is common to find a program with dozens of lines of checking whether it is one version of a compiler or another when the program just wants to know whether memcpy comes with it or not. It is much better if we could ask the C compiler whether memcpy was in a header or not at program time with some builtin routine and have that routine return a boolean.
I am not sure i understand exactly what you mean, but if i do understand, i'd like to respectfully submit this is a feature i have asked for in OE for years: the ability to test for existance of a function:
$isalias(name,[N]) Returns $true if the specified name is an alias command that exists in your aliases or scripts. Properties: fname, alias, ftype $isalias(join) returns $true if you have an alias for /join $isalias(join).fname returns the filename in which the alias exists $isalias(join).alias returns the alias definition for /join $isalias(join).ftype returns alias or remoteAs you see, stopping at one boolean return is too unimaginative. A corresponding feature would be to get the full list of what is available (functions, libs, or variables). A workaround i have used is to have the code simply open and read the code. Adding features like this is far from being a "kitchen sink syndrome", it's more like "stop copying the languages you are trying to overtake, because they have already beat you".