1. Another namespace addition for 4.0?

Matt,

Would it be useful/possible to be able to declare a namespace in the actual
include file? Here's what I am thinking, please let me know what you think. I
cannot imagine it would be too hard, but I could be wrong.

==== datetime.e
namespace dt

global function new(integer year, ....)
end function


==== myprog.ex
include datetime.e

datetime dt1
dt1 = dt:new(....)


Or, if a user wished, they could override the namespace:

==== myprog2.ex
include datetime.e as datetime

datetime dt1
dt1 = datetime:new(....)


--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » topic index » view message » categorize

2. Re: Another namespace addition for 4.0?

Jeremy Cowgar wrote:
> 
> Matt,
> 
> Would it be useful/possible to be able to declare a namespace in the actual
> include file? Here's what I am thinking, please let me know what you think.
> I cannot imagine it would be too hard, but I could be wrong.
> 
> ==== datetime.e
> }}}
<eucode>
> namespace dt
> 
> global function new(integer year, ....)
> end function
> </eucode>
{{{

> 
> ==== myprog.ex
> }}}
<eucode>
> include datetime.e
> 
> datetime dt1
> dt1 = dt:new(....)
> </eucode>
{{{

> 
> Or, if a user wished, they could override the namespace:
> 
> ==== myprog2.ex
> }}}
<eucode>
> include datetime.e as datetime
> 
> datetime dt1
> dt1 = datetime:new(....)
> </eucode>
{{{

> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

This looks like a crude definition of a package. I'm 100% for it, have it
implemented in Æ and there has been much discussion last year about it...

CChris

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

3. Re: Another namespace addition for 4.0?

CChris wrote:
> This looks like a crude definition of a package. I'm 100% for it, have it
> implemented
> in � and there has been much discussion last year about it...

My 1e-2 cents:

I hate looking at ":" for the namespace specifier.
It looks unclean (not easily distinguisable from a letter), 
hard to type, and not common. "_" is much cleaner...

Any reason why didn't we use . instead of : ?

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

4. Re: Another namespace addition for 4.0?

yuku wrote:
> 
> CChris wrote:
> > This looks like a crude definition of a package. I'm 100% for it, have it
> > implemented
> > in � and there has been much discussion last year about it...
> 
> My 1e-2 cents:
> 
> I hate looking at ":" for the namespace specifier.
> It looks unclean (not easily distinguisable from a letter), 
> hard to type, and not common. "_" is much cleaner...
> 
> Any reason why didn't we use . instead of : ?

Not to get picky, but . is easier to look at, distinguish and type. I've had
problems with my hands in the past and it's due mainly to the pinky reaching for
the shift key. However, I have gotten over that, I use a foot pedal now and a
true split keyboard (1/2's are separated by about 5 inches). The foot pedal works
Alt, Ctrl and Shift.

But, something to think about.

--
Jeremy Cowgar
http://jeremy.cowgar.com

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

5. Re: Another namespace addition for 4.0?

yuku wrote:
> 
> CChris wrote:
> > This looks like a crude definition of a package. I'm 100% for it, have it
> > implemented
> > in � and there has been much discussion last year about it...
> 
> My 1e-2 cents:
> 
> I hate looking at ":" for the namespace specifier.
> It looks unclean (not easily distinguisable from a letter), 
> hard to type, and not common. "_" is much cleaner...
> 
> Any reason why didn't we use . instead of : ?

The "hard to type" part is not true on non US keyboards. For instance, the
french keyboard has a key (above Right Alt) that gives : unshifted and / shifted.
Don't you have to shift - to access _?

Not common: :: is more usual, granted. But : is simpler than ::, right?

. smacks of object oriented programming, and you know the baleful fate of
heretics to the dogma of procedural programming here... I'm among those heretics.

Further, since _ is a valid inner character for identifiers, it would not be
clear whether a given _ denotes a namespace or simply separates words.

So I'd consider : as not bad. Perhaps @ could be better, although it would be
more natural then to write <symbol> at <namespace>.

CChris

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

6. Re: Another namespace addition for 4.0?

CChris wrote:
> Not common: :: is more usual, granted. But : is simpler than ::, right?

Somehow :: separates words more obviously than :.

Compare

datetime::add(a, b)
datetime::to_unix(a)

with

datetime:add(a, b)
datetime:to_unix(a)


even so, still not as intuitive as


datetime.add(a, b)
datetime.to_unix(a)


> . smacks of object oriented programming, and you know the baleful fate of
> heretics
> to the dogma of procedural programming here... I'm among those heretics.

Do you mean that it will confuse people with OOP background?


> Further, since _ is a valid inner character for identifiers, it would not be
> clear whether a given _ denotes a namespace or simply separates words.

I should have said "*Even* \"_\" is much cleaner...", I didn't mean
namespace but using prefixes :P

> So I'd consider : as not bad. Perhaps @ could be better, although it would be
> more
> natural then to write <symbol> at <namespace>.

Let's imagine more extremely.. how about this 

import datetime.e as dt

datetime dt1, dt2

dt1 = dt new(1999, 1, 2, 3, 4, 5)
dt2 = dt add(dt1, 2, MINUTES)

puts(1, dt format(dt2, "%Y-%m-%d"))


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

7. Re: Another namespace addition for 4.0?

I started a new thread for . or : or ???? Can we please continue this discussion
there and leave this thread for the discussion of the idea:

=== datetime.e
namespace dt
global function abc()
--- ...



=== myprog.e
include datetime.e
dt:abc()



The new thread is: http://www.openeuphoria.org/EUforum/m19984.html

Thanks.

--
Jeremy Cowgar
http://jeremy.cowgar.com

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

8. Re: Another namespace addition for 4.0?

CChris wrote:

> . smacks of object oriented programming, and you know the baleful fate of
> heretics
> to the dogma of procedural programming here... I'm among those heretics.

I like the way the . looks better than the :, so I would vote for the .. It
doesn't have to mean object-oriented. But my IDE is very handy for when I
start typing

include datetime.e as dt

   my_var = dt.

and a drop-down list pops up of available datetime functions. That's cool.
Or would be. Could be.

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

9. Re: Another namespace addition for 4.0?

> On 25 Apr 2008 at 11:15, CChris wrote (maybe snipped):

> 
> 
> posted by: CChris <christian.cuvier at a?riculture.gouv.fr>
> 
-<snip>-
 
> So I'd consider : as not bad. Perhaps @ could be better, although it
> would be more natural then to write <symbol> at <namespace>.
> 
I was about to suggest that "@" but then realize it's even worse than 
":" to type in. I liked the dot idea but it's a common specifier for 
OO bound languages. So, my vote goes to the colon if we can't take 
the dot. ;^)

Best,
Euler

-- 
_
_| euler f german
_| sete lagoas, mg, brazil
_| efgerman{AT}gmail{DOT}com
_| -----------------------------
_| Reply preferably to the list,
_| or to the address above. Thx!

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

10. Re: Another namespace addition for 4.0?

Jeremy Cowgar wrote:
> 
> Matt,
> 
> Would it be useful/possible to be able to declare a namespace in the actual
> include file? Here's what I am thinking, please let me know what you think.
> I cannot imagine it would be too hard, but I could be wrong.

I think that's an interesting idea.  Basically, a default.

Matt

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

11. Re: Another namespace addition for 4.0?

yuku wrote:
> 
> CChris wrote:
> > This looks like a crude definition of a package. I'm 100% for it, have it
> > implemented
> > in � and there has been much discussion last year about it...
> 
> My 1e-2 cents:
> 
> I hate looking at ":" for the namespace specifier.
> It looks unclean (not easily distinguisable from a letter), 
> hard to type, and not common. "_" is much cleaner...
> 
> Any reason why didn't we use . instead of : ?

I'd prefer ':'.  It's more obvious.

Matt

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

12. Re: Another namespace addition for 4.0?

Matt Lewis wrote:
> 
> I'd prefer ':'.  It's more obvious.

I have to use VBA quite a bit where I work, so the . is beautiful to me. :)

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

13. Re: Another namespace addition for 4.0?

Matt Lewis wrote:
> 
> Jeremy Cowgar wrote:
> > 
> > Matt,
> > 
> > Would it be useful/possible to be able to declare a namespace in the actual
> > include file? Here's what I am thinking, please let me know what you think.
> > I cannot imagine it would be too hard, but I could be wrong.
> 
> I think that's an interesting idea.  Basically, a default.
> 
> Matt

Yeah, that's kind of the way that I saw it too. An overridable default.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

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

14. Re: Another namespace addition for 4.0?

c.k.lester wrote:
> 
> Matt Lewis wrote:
> > 
> > I'd prefer ':'.  It's more obvious.
> 
> I have to use VBA quite a bit where I work, so the . is beautiful to me. :)

My condolences.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu