1. namespace

Strangely enough quite recently I tripped again over the following 
aspect of the brave new world of 'improved' namespace handling:


-- test.e 
global constant a = 1


-- test.ex
include test.e
? a
constant a = 2
? a


-- output
1
2


Not even a simple warning about the previous instance! Is this 
really desirable/acceptable behaviour?

jiri

new topic     » topic index » view message » categorize

2. Re: namespace

Hi, Derek! You wrote:

>I believe that RDS is considering issuing a warning whenever a declaration
>overrides another one. However, which behaviour are you upset over - the
>missing warning or the overriding?
>
>I would like the overide functionality to continue. But I wonder if, when we
>get the warning message facility, the programmer could code something like
>...
>
>  override constant a = 2
>
>This would do two things: Skip the message being issued and alert the reader
>of the code to the fact that the override is deliberate.

I must admit I do not see your point in having this sort of 'functionality'. If
the 'constant' is no longer a constant, make it into a variable and simply
re-assign it.

The behaviour is also inconsistent: for instance we are not allowed to override
user defined routines, where it would be, often, very useful.

>Another point, Jiri. The style of coding you demonstrate above, seems to say
>that you knew that 'a' had been declared in test.e (thus the first "? a"
>command). You then declare another 'a', knowing that the first one existed.
>The problem for a code reader is then - is this second declaration a mistake
>or deliberate?

Sorry, Derek, that was just an illustration, simplified. In actual case I am
currently updating a large application with a number of cascading includes,
cutting and pasting, also using several versions. It just happened I had the
same constants (flags) declared at different levels with slightly different
values - and it took me two days to trace the bug...

jiri

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

3. Re: namespace

Hi, Karl. You wrote:

>I think you have a point. A global constant should be both
>global and constant! I have modified Bliss to enforce this, but
>to allow duplicate definitions (many files can do 'global FALSE = 0').

Duplicate definitions are not terribly clean, but since they are also completely
harmless I can live with them ;).

>Bliss now allows classes to have constants as members which
>opens up some maybe useful namespacing techniques.
>
> class Windows_constants
>     constant
>     BN_KILLFOCUS = 7,
>     BN_CLICKED = 0
>     -- You could probably think of a few more!
>  end class
<snip>

Interesting. But I hasten to add I have never been a fan of OO techniques as
such; in my opinion they are the principal cause of the enormous software bloat
of the last decade. I suppose it's one of those ideas that were just too much
ahead of their time: only quite recently computers acquired sufficient memories,
storage capacities and the processing power to deal, adequately, with attendant
requirements.

Personally, I believe the whole namespace mess can be neatly avoided using some
sort of a modular scheme with a very simple interface.

I am also sorry I cannot comment on your baby, since I have not studied Bliss in
any detail. Perhaps just one, very superficial impression - I hope you will not
be too offended: it seems to be a bit of an eclectic mixture; perhaps you are
trying to please too many people with too many pet ideas...

And talking about Eu hacks, I am really looking forward to Matt Lewis' effort.
He promises better error handling/reporting and a 'variable_id' sort of a thing,
a very old couple on my wish list.

jiri

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

4. Re: namespace

-------Phoenix-Boundary-07081998-

Hi Jiri Babor, you wrote on 7/11/02 3:52:53 AM:

>
>Hi, Karl. You wrote:
>
>I think you have a point. A global constant should be both
>global and constant! I have modified Bliss to enforce this, but
>to allow duplicate definitions (many files can do 'global FALSE =3D 0').
>
>Duplicate definitions are not terribly clean, but since they are also 
>completely
>harmless I can live with them ;).
>

I have had a change of heart here. The Euphoria approach of
allowing all redefinitions seems correct. The meaning of an
id is determined first by the current subprogram, then by the
program, and finally by the external file. It might be useful to
have a 'lint' option that would warn about this and the
re-definition of built-ins.

>Bliss now allows classes to have constants as members which
>opens up some maybe useful namespacing techniques.
>
> class Windows_constants
>     constant
>     BN_KILLFOCUS =3D 7,
>     BN_CLICKED =3D 0
>     -- You could probably think of a few more!
>  end class
><snip>
>
>Interesting. But I hasten to add I have never been a fan of OO
> techniques as such; in my opinion they are the principal cause
> of the enormous software bloat of the last decade. I suppose
> it's one of those ideas that were just too much ahead of their
> time: only quite recently computers acquired sufficient memories,
>storage capacities and the processing power to deal, adequately,
> with attendant requirements.
>
I too have been (and remain) deeply suspicious of OO. Their
main usefulness seems to be in a few specific kinds of complex
programs such as GUI's. But I also see classes and dot-notation
as very powerful tools for producing cleaner procedural code.
Another way of expressing and controlling modularity is helpful.
Bliss does not have virtual methods, co- or contra-variance, or
polymorphism (beyond that provided by sequences).

>
>I am also sorry I cannot comment on your baby, since I have
> not studied Bliss in any detail. Perhaps just one, very
> superficial impression - I hope you will not be too offended:
> it seems to be a bit of an eclectic mixture; perhaps you 
>are trying to please too many people with too many pet ideas...
>

The intention of Bliss is to add two types of features to Euphoria:

First my pet ideas, such as slicing shorthands, variable initializations
 etc. This category has been evolving as others make suggestions, and
 may be fairly criticized as too many pet ideas.

Secondly, significant enhancements such as classes, exceptions,
 cdecl callback capability, and so forth. I think a fair criticism of
 these features might be that they create a new language  (i.e. It's not
 Euphoria any more).

I do agree that I am sometimes over-responsive to suggestions, but
this is partly a symptom of the young age of the language.
I consider Bliss to be largely complete now (with the recent addition
of member constants and initializers). I remain open to the possible
addition of useful features that don't intefere with what's
already there. 

Regards
Karl Bochert

-------Phoenix-Boundary-07081998---

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

Search



Quick Links

User menu

Not signed in.

Misc Menu