Re: Forward Definitions

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

Gabriel Boehme wrote against forward definitions:

> So, if we're going to do away with declare-before-use, we've got to
> do away with built-in redefinitions.

If this is your *real* complaint, why attack Jiri and set up straw-men
arguments against forward declarations?

Personally, I'm not fond of the idea that built-ins can be redefined
(overloaded). It flys in the face of simplicity, consistancy and
expectation:

1. Only built-ins can be redefined.
2. A built-in can only be redefined once.
3. Built-ins don't return valid routine id's.
4. Redefined built-ins return valid routine id's.
4. Built-in functions should remain constant in function.

Consider the following example:

        include magic_1.e
        include magic_2.e

        if routine_id("puts") = -1 then
                puts(1,"not redefined")
        else
                puts(1,"redefined")
        end if

It's impossible to determine what the code will do, despite it using only
"built in" functions. Will it:

        - print "not redefined"?
        - print "redefined"?
        - abort because of an error?
        - abort because both include files tried to redefine 'puts'?
        - abort because I didn't bother to test it? blink

I'd much rather change the behavior to:

1. Disallow routines in the same scope to be redefined.
2. Have built-ins return valid routine id's.

and, of course, my constant complaints:

3. Change the scope of routine_id to the run time scope, not compile time.
4. Have routine_id return a 0 on failure, not -1.


-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu