Cases where I miss C++ 'using'
Daniel Keep
daniel.keep.lists at gmail.com
Mon Nov 6 18:47:47 PST 2006
Bill Baxter wrote:
> ...
>
> As an alternative to that, an alias-like "with declaration" would be handy:
>
> void do_something()
> {
> with std.math, std.string;
> str = format("%f <= %f", fmin(a,b), fmax(a,b));
> ...
> ...
> }
>
Or, you could use this to keep it consistent with various other
block-modifying keywords:
> void do_something()
> {
> with(std.math):
> with(std.string): // or even with(std.math,std.string):
> str = format("%f <= %f", fmin(a,b), fmax(a,b));
> ...
> ...
> }
> --
> Finally I wish there were some way to bring all the values in an *enum*
> into the current name resolution scope. For example:
>
> enum Buttons {
> Left,
> Right,
> Middle
> }
> with(Buttons) { // doesn't work!
> x = Left|Middle
> }
> alias Buttons B;
> y = B.Left | B.Middle; // ok, but not as nice looking
>
>
> --bb
Allowing you to use an Enum's name without the prefix is one of the
things I actually miss about Visual Basic. Sure, requiring the prefix
is nice for the sake of organisation, but it gets *really* aggravating
after a while.
-- Daniel
--
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list