Re: Issue of the week

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

Maybe we ought to rename this thread "The Cyrek and Hawke Show"
or something :)

On Fri, 2 Oct 1998, Hawke wrote:

> the part above that where i referred to overloading giving
> me a headache as you "overloaded" the '*' to mean PLUS
> was darned near serious...

I was demonstrating what *could* be done. Not "*should* be" :)

> mebbe it's just me, but try as i might, i cannot come up
> with code that obfuscated.  my teachers used 20lb sledge's
> to bash my brains with the 'code clearly' concept.
> i still have nightmares =->

It's dictionary (on the fly) definitions time:

1) Overloading: To have more than one function/procedure with the same
   name doing different things. If I had time, I'd patch one of the
   preprocessors to do it in Euphoria.

   You (and the compiler/interpreter) can tell them apart by what
   parameters they accept...

   e.g. These are all completely different (despite having the same name):

       procedure cheese(integer a, integer b)
           -- Two parameters of type integer
       end procedure

       procedure cheese(integer a, atom b)
           -- Two parameters, first integer, second atom
       end procedure

       function cheese(integer a, atom b)
           -- Two parameters, first integer, second atom
           -- Just like above, but this is a *function*
           return power(b,b-a)
       end function

       procedure cheese(atom a, integer b)
           -- Two parameters, first atom, second integer
       end procedure

       procedure cheese(integer a, integer b, integer fish)
           -- Three parameters of type integer
       end procedure

2) Redefining: Completely re-writing the function/procedure, overriding
   the original. This is only really possible in Euphoria. Most other
   languages will complain (C will for instance) or attempt to Overload
   the function/procedure (Ada, C++, newer Pascals). I showed examples of
   this in earlier posts.

Any clearer, or should we move to one-on-one e-mail?
Carl

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

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

Search



Quick Links

User menu

Not signed in.

Misc Menu