1. Euphoria ver 2.3

I hope version 2.3 is going to allow FORWARD REFERENCES
  instead of the stupid routine_id()

Rob:

  Why can't you just allow a user to redefine a routine if
  the routine has the exact same parameter list.

  Here is my idea:
  
  A user creates a empty prototype function ( dummy function
  with NO CODE INSIDE OF IT ) at the beginning of his
  program ( just after the include files ) for any routine they wish
  to use in a forward reference.
  When the interpeter parses the program and if it finds a
  redefinition of the prototype and the parameters are exactly the
  same then the interpeter replaces the definition with the new
  definition. This replacement would only be allowed once ! 
  
  ERROR conditions that can occur are:
    1. A prototype is trying to redefine a function in a include
       file.
    2. A function is trying redefine a prototype with a different
       parameter list.
    3. A function is being redefined more than once.
    4. A function is being redefined that was not prototyped just
       after the include files ( the prototype functions list end
       when the first function that CONTAINS CODE inside it is 
       encountered by the interpter). 

  The above errors would cause the same error message that we get
  with the present interpeter.

  Programs would be easier to read and follow, compiled code could
  be used in DLL's because routine_id is not needed.
  The old programs would still work the same way because no code
  would be broken.
  
Bernie

new topic     » topic index » view message » categorize

2. Re: Euphoria ver 2.3

On 3 Jun 2001, at 19:22, Bernie Ryan wrote:

> 
> 
>   I hope version 2.3 is going to allow FORWARD REFERENCES
>   instead of the stupid routine_id()
> 
> Rob:
> 
>   Why can't you just allow a user to redefine a routine if
>   the routine has the exact same parameter list.

Why not allow this?

function x(sequence a)
function x(integer b, sequence a)
function x(atom a)

Then the interpreter can check the passed parms as it does now, and drop them
into
the correct function. Like this: when the interpreter is running thru the list
of functions,
and the name is found but parameter list types don't match, store the error, but
don't
report it, and keep searching the list. If the name and types match later in the
list, use
it. If the name and types never match, then report the error.

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: Euphoria ver 2.3

Kat wrote:

> Why not allow this?
>
> function x(sequence a)
> function x(integer b, sequence a)
> function x(atom a)

Well, you can't determine the type that an 'object' will be until runtime:

   object o
   ...
   x( o )

The interpreter is at a loss how to link this until runtime. Adding late
binding would be a major change for Euphoria. And if you disallowed object
in parameter lists, you'd break a *lot* of code.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu