Re: Convergence in Programming Languages
- Posted by DerekParnell (admin) Mar 07, 2009
- 900 views
I see now that computer languages including become more and more alike through feature additions. Perhaps all languges will eventually look more or less like Python or Perl. Could it be just a metter of time before they all have each other features and the only difference would be syntax?
Heaven forbid! Diversity is our salvation.
So, I propose we add that feature to EUPHORIA like this:
type enum with strings colors C_RED, C_YELLOW, C_BLUE, C_GREEN, C_BLACK, C_WHITE builtin function get_to_string_routine( sequence type_name ) color_names = get_to_string_routine( "colors" )
This is similar to the length() function. That returns an attribute of the variable. It would be very conceivable to have a built-in function that returns the source code name for an enum when given the enum's value.
---- type enum colors C_RED, C_YELLOW, C_BLUE, C_GREEN, C_BLACK, C_WHITE object foo foo = C_BLUE -- This outputs "C_BLUE" printf( 1, enum_text( foo, colors ) ) ----
Also, APIs use bits in a single integer to turn features on or off. So, if we can have a way of making the enums be geometric with 2 then we can do even neater stuff.
Yes. This has been discussed before and is a planned addition to Euphoria, but after 4.0 has been released.
Macros routines are things I see in C. Doesn't inlining make it redundant? Well, these little macros are often little things that use a routine's locals as globals. In C they can even be used to break or continue a loop that is not in the macro itself but in the caller of the macro. So, suppose we have something like this:
function big_function( sequence s, sequence t ) -- big routine function little_macro() s+=1 t=1 continue -- do we want this kind of thing?? end function . . while condition1 do if condition2 then j = little_macro() end if . . end function
What do you think of this syntax?
This has also been discussed. This is an example of a nested routine. We will be adding these to Euphoria, but again, not for the 4.0 release.