On 02/27/2011 07:21 AM, %u wrote:
Actually, on a second thought, I just noticed that the union method
*is* extensible, since you're putting things in different unions... I
think I'll give it a shot, thanks! :)
And you can always "super-compose" unions. This view, in fact, is similar to
the (fa
On 02/27/2011 04:20 AM, Nick Sabalausky wrote:
"Nick Sabalausky" wrote in message
news:ikcepj$248p$1...@digitalmars.com...
I think your main original problem was that there isn't really a way to
compose enums additively, only subtractive.
That just gave me an idea: I think you should be abl
Actually, on a second thought, I just noticed that the union method
*is* extensible, since you're putting things in different unions... I
think I'll give it a shot, thanks! :)
> I know some people don't like using mixins, but I think that's
really the best way to achieve that effect without loosing DIY and
without resorting to something more heavy-weight
> ...
> That just gave me an idea: I think you should be able to get away
with an ordinary union
I thought about thos
"Nick Sabalausky" wrote in message
news:ikcepj$248p$1...@digitalmars.com...
>
> I think your main original problem was that there isn't really a way to
> compose enums additively, only subtractive.
>
That just gave me an idea: I think you should be able to get away with an
ordinary union:
enu
"%u" wrote in message
news:ik7slf$2q2u$1...@digitalmars.com...
>> What exactly is it that you're trying to do?
>
>
>>> (1) I'm not going to create a new instance of an entire class
> every single time I need to check an access mask, that's wasteful.
>> I meant, you write File.open or File.isReada
> As long as you expose OS cruft, your wrappers are useless, I'm
afraid.
> I suggest you to provide safe and meaningful wrappers, e.g.
streams, ranges, for concrete business cases which deal with OS
directly so that the wrapper won't need flags from user (they are
usually encoded in the function na
%u Wrote:
> So the question is, what's the best way to do it?
As long as you expose OS cruft, your wrappers are useless, I'm afraid.
I suggest you to provide safe and meaningful wrappers, e.g. streams, ranges,
for concrete business cases which deal with OS directly so that the wrapper
won't nee
> What exactly is it that you're trying to do?
>> (1) I'm not going to create a new instance of an entire class
every single time I need to check an access mask, that's wasteful.
> I meant, you write File.open or File.isReadable which do the job
for you and don't expose OS cruft.
That's what I'
%u Wrote:
> >> Lol, okay. Do you have any other suggestions for a better
> solution on how to avoid duplicating generic access masks like
> MAXIMUM_ALLOWED inside each access mask type?
>
> > You're doing it wrong. Create OO wrapper instead.
>
> Hm... but:
>
> (1) I'm not going to create a new
"%u" wrote in message
news:ik70pq$1a37$1...@digitalmars.com...
>>> Lol, okay. Do you have any other suggestions for a better
> solution on how to avoid duplicating generic access masks like
> MAXIMUM_ALLOWED inside each access mask type?
>
>> You're doing it wrong. Create OO wrapper instead.
>
>
>> Lol, okay. Do you have any other suggestions for a better
solution on how to avoid duplicating generic access masks like
MAXIMUM_ALLOWED inside each access mask type?
> You're doing it wrong. Create OO wrapper instead.
Hm... but:
(1) I'm not going to create a new instance of an entire class e
%u Wrote:
> Lol, okay. Do you have any other suggestions for a better solution on how to
> avoid duplicating
> generic access masks like MAXIMUM_ALLOWED inside each access mask type?
You're doing it wrong. Create OO wrapper instead.
>> enum AccessMask { GenericRead = 0x8000 }
>> enum FileAccess : AccessMask { ReadData = 1 } //Errors
> Nice. Has Walter thought about the possibility of such D code? Similar
> problems with typedef
(that doesn't play well with OOP) have pushed Andrei to remove typedef from D.
So be careful,
"%u" wrote in message
news:ik432q$29qu$1...@digitalmars.com...
>I have a question on enum "inheritance" -- I'm wondering if what's
>happening below is a bug or by
> design?
>
> I have code like this:
>
> enum AccessMask { GenericRead = 0x8
%u:
> enum AccessMask { GenericRead = 0x8000 }
> enum FileAccess : AccessMask { ReadData = 1 } //Errors
Nice. Has Walter thought about the possibility of such D code?
Similar problems with typedef (that doesn't play well with OOP) have pushed
Andrei to remove typedef from D. So be careful, o
I have a question on enum "inheritance" -- I'm wondering if what's happening
below is a bug or by
design?
I have code like this:
enum AccessMask { GenericRead = 0x8000 }
enum FileAccess : AccessMask { ReadData = 1 } //Errors
void foo(FileAccess a) { /*Do something*
17 matches
Mail list logo