August 13, 2004 Re: OT Laziness (was Re: Enums...) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arcane Jill | "Arcane Jill" <Arcane_member@pathlink.com> wrote in message news:cfcgjg$4v6$1@digitaldaemon.com... > I take pride in being lazy. When I was studying math at school, I was taught > that math is all about being lazy, and that the very best mathematicians are the > laziest of all. If you cou prove a theorem ONCE for (say) "rings", then you've > proven it for reals, integers, whatever. There are parallels with OOP here - > component re-use is all about being lazy. I also write libraries because I'm > lazy (why write the same piece of code more than once?). I use Phobos routines > because I'm lazy (why write a piece of code at all if someone else has done it > for me?). I even write in D because I'm lazy (why invent my own brand new > computer language when I can just use Walter's?). I dunno, but I guess those mad > workaholic types just enjoy re-inventing the wheel all the time, or maybe they > just get a buzz out of pressing keys on their keyboard? Most engineering progress is made by lazy people. The person who invented automatic valves on steam engines was the boy who had to run up and down a ladder for every stroke of the piston. He rigged up a pole and some levers to do it for him, and was discovered asleep beside the engine, which was running just fine. |
August 13, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | "Regan Heath" <regan@netwin.co.nz> wrote in message news:opschrxff75a2sq9@digitalmars.com... > Surely it's possible in most cases for the compiler to determine the Enum name and thus it's not really required. Making this work would break the bottom-up typing system of D expressions. It has the potential of making the types of many expressions simply unresolvable. |
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> "Regan Heath" <regan@netwin.co.nz> wrote in message
> news:opschrxff75a2sq9@digitalmars.com...
>
>>Surely it's possible in most cases for the compiler to determine the Enum
>>name and thus it's not really required.
>
> Making this work would break the bottom-up typing system of D expressions.
> It has the potential of making the types of many expressions simply
> unresolvable.
Why is this any harder than finding the names of things in imported files?
|
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | Russ Lewis wrote:
> Walter wrote:
>
>> "Regan Heath" <regan@netwin.co.nz> wrote in message
>> news:opschrxff75a2sq9@digitalmars.com...
>>
>>> Surely it's possible in most cases for the compiler to determine the Enum
>>> name and thus it's not really required.
>>
>>
>> Making this work would break the bottom-up typing system of D expressions.
>> It has the potential of making the types of many expressions simply
>> unresolvable.
>
> Why is this any harder than finding the names of things in imported files?
Ok, so to be just a little wacky, here's a enum-as-mixin
enum Foo : uint { FOO, BAR, BAZ; };
turns into:
template FooTemplate(T) {
typedef T Foo;
const T FOO = 0;
const T BAR = 1;
const T BAZ = 2;
}
mixin FooTemplate!(uint) FooM;
void func(Foo f) { ... }
func(FOO | BAR | BAZ);
// if there is any ambiguity with other enums or local variables...
func(FooM.FOO | FooM.BAR | FooM.BAZ);
|
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:cfjlm3$1cr3$1@digitaldaemon.com... > Walter wrote: > > "Regan Heath" <regan@netwin.co.nz> wrote in message news:opschrxff75a2sq9@digitalmars.com... > > > >>Surely it's possible in most cases for the compiler to determine the Enum > >>name and thus it's not really required. > > > > Making this work would break the bottom-up typing system of D expressions. > > It has the potential of making the types of many expressions simply unresolvable. > > Why is this any harder than finding the names of things in imported files? I hadn't thought of implementing it like an import, you might be right. I think the semantics of looking up symbols in imports is straightforward, but a lot of people here find it incomprehensible. I don't understand why, but because of that I am hesitant to expand its application. |
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <cflk30$2io9$1@digitaldaemon.com>, Walter says... > >I hadn't thought of implementing it like an import, you might be right. I think the semantics of looking up symbols in imports is straightforward, but a lot of people here find it incomprehensible. I don't understand why, but because of that I am hesitant to expand its application. Always seemed pretty straightforward to me. And we're stuck with import behavior for import anyway, so why not expand it to cover other areas where it seems appropriate? It would be better than having different rules for different aspects of the language. Sean |
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <cflk30$2io9$1@digitaldaemon.com>, Walter says... >> >> Why is this any harder than finding the names of things in imported files? > >I hadn't thought of implementing it like an import, you might be right. I think the semantics of looking up symbols in imports is straightforward, but a lot of people here find it incomprehensible. I don't understand why, but because of that I am hesitant to expand its application. I say go for it! The import rules _are_ straightforward: if the identifier exist in one module, use it. If it exists in more modules, complain. Use alias to remove the complaints. That's it ;-) Nick |
August 14, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick | <groan> Please ... no more alias ... "Nick" <Nick_member@pathlink.com> wrote in message news:cfln3a$2k0p$1@digitaldaemon.com... > In article <cflk30$2io9$1@digitaldaemon.com>, Walter says... > >> > >> Why is this any harder than finding the names of things in imported files? > > > >I hadn't thought of implementing it like an import, you might be right. I think the semantics of looking up symbols in imports is straightforward, but > >a lot of people here find it incomprehensible. I don't understand why, but > >because of that I am hesitant to expand its application. > > I say go for it! The import rules _are_ straightforward: if the identifier exist > in one module, use it. If it exists in more modules, complain. Use alias to > remove the complaints. That's it ;-) > > Nick > > |
August 15, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to antiAlias | antiAlias schrieb:
> <groan>
>
> Please ... no more alias ...
Ur, what?
Who are you anyway?
-eye/photoallergics
|
August 15, 2004 Re: Enums can be annoyingly verbose... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | Ilya Minkov wrote: > antiAlias schrieb: > >> <groan> >> >> Please ... no more alias ... > > > Ur, what? > > Who are you anyway? If you can't guess who he is, he shouldn't have to bother telling you. Think about it... Think about whose name might have disappeared about the same time the new name appeared. Read antiAlias's posts. It's not that hard to figure out. > > -eye/photoallergics -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/ |
Copyright © 1999-2021 by the D Language Foundation