Re: Why doesn't this work? (short)

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

----- Original Message -----
From: <mistertrik at hotmail.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: Why doesn't this work? (short)


>
> >EU is simple and clear language,
> >please, do not forget about this=20
> >simple thing.
>
> I agree.
>
> Having the ability to undefine something is likely to cause all sorts of
> problems.


But you already do it! For example...

----------
sequence MyTitle
MyTitle = "Programmer"

procedure xx()
  sequence MyTitle

  MyTitle = "Designer"

  printf(1, "%s\n", {MyTitle})
end procedure
printf(1, "%s\n", {MyTitle})
-----------

During the scope of xx() the variable MyTitle defined outside the routine is
'undefined'. It magically reappears after the xx() routine.

> I think that if you have the same constant name as a library you are
using,
> that is a problem. The onus on the programmer is to make sure that there
are
> not conflicts between your code and the library. The onus on the library
> developer is to use distinct constant names, for example in msgbox.e, all
> constants start with MB_. Not likely to be conflicts there.
>
> The one exception to this rule I think would be generic things, like NULL,
> X, Y, etc. Simple constants that have a relevance across an entire
library,
> not just to a particular section. Now these values will have a certain
> significance attached to their value... ie NULL = -1. X = 1, Y = 2, etc...
> If these constants are declared in the programmers code, it is likely that
> they will be assigned the same values.
>
> I think it would be best if Euphoria generated an error on encountering a
> constant declared twice, UNLESS that constant has the same literal value.
If
> someone declares NULL to be -1 in their code, but it is already declared
in
> a library, I would say that makes the code easier to understand.
>
> For purists sake, I think the occurance of a constant declared twice to be
> the same thing should generate a warning, one suppressible by using
'without
> warning'

Global constants and global routines have different needs. In your
discussion above you only talk about constants. What you are saying makes a
lot of sense - for constants. However, the chance for routine names to be
duplicated and there code to be VERY different is quite high.

----------------
cheers,
Derek Parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu