On 8/10/2014 6:52 PM, Era Scarecrow wrote:
On Monday, 11 August 2014 at 00:23:36 UTC, Walter Bright wrote:
I'd suggest simply:
private alias FlagStates FS;
then use FS.def, etc.
The source code has 400 lines (955-1376) where it uses flags of one kind or
another. Constantly having to
On Monday, 11 August 2014 at 06:29:55 UTC, Walter Bright wrote:
It's not ideal, but it gets the job done. Keep in mind that you
are proposing to use withs to mix up multiple enums with lots
of members - name clashes are very possible, and there's no
visual clue which enum a name belongs to. It
On 08/10/14 23:01, Era Scarecrow via Digitalmars-d wrote:
Does with have to be only for statements?
Real example. In my code somewhere i have a large list of enum types that
specify a type of formatting and visibility options.
[...]
Now since i can't use with(): I'm forced to do aliases,
On Monday, 11 August 2014 at 12:25:52 UTC, Artur Skawina via
Digitalmars-d wrote:
What you're really looking for is context dependent access to
the target scope. That would work for statics and enums, but
would probably require a new syntax (it becomes too misleading
and/or ambiguous
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in 'digitalmars-d-le...@puremagic.com
mailto:digitalmars-d-le...@puremagic.com' forum
There's already an implementation proposed.
No other statement construct works like that, there doesn't
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
'digitalmars-d-le...@puremagic.com
mailto:digitalmars-d-le...@puremagic.com' forum
There's already an implementation
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
No other statement construct works like that, there doesn't
seem to be much point to adding such a special case.
Guess
Brian Schott wrote in message
news:rvypuokvvvoeamryb...@forum.dlang.org...
---
static if (true)
alias A = B;
else:
alias A = C;
alias D = E;
---
'statement'
On Sunday, 10 August 2014 at 08:34:40 UTC, Era Scarecrow wrote:
Depends on how many pesky extra braces you want to avoid...
enum Flags {a,b,c,readonly,write,etc}
void func(Flags f){
switch(f) {
with(Flags): //or put this outside the switch...
For that specific case, put it outside
On Sunday, 10 August 2014 at 08:45:00 UTC, safety0ff wrote:
For that specific case, put it outside the switch and drop the
colon:
True, although if you repeat having to work with the type of Foo
(or Flags or something) multiple times then the with(): would let
you avoid having multiple
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
'digitalmars-d-le...@puremagic.com
mailto:digitalmars-d-le...@puremagic.com' forum
There's already an implementation
On 10/08/2014 9:34 p.m., Marc Schütz schue...@gmx.net wrote:
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
'digitalmars-d-le...@puremagic.com
On Sunday, 10 August 2014 at 08:29:14 UTC, Brian Schott wrote:
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
'digitalmars-d-le...@puremagic.com
On Sunday, 10 August 2014 at 12:34:47 UTC, Idan Arye wrote:
On Sunday, 10 August 2014 at 08:29:14 UTC, Brian Schott wrote:
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
On 8/10/14, 1:44 AM, safety0ff wrote:
On Sunday, 10 August 2014 at 08:34:40 UTC, Era Scarecrow wrote:
Depends on how many pesky extra braces you want to avoid...
enum Flags {a,b,c,readonly,write,etc}
void func(Flags f){
switch(f) {
with(Flags): //or put this outside the switch...
On 8/10/2014 1:29 AM, Brian Schott wrote:
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
No other statement construct works like that, there doesn't seem to be much
point to adding such a special case.
---
static if (true):
alias A = B;
---
---
static if (true)
On 8/10/2014 2:34 AM, Marc Schütz schue...@gmx.net wrote:
It's possible to add this syntax for any statement,
The reason for the : syntax for declarations is that modules can be quite long,
and it:
1. avoids a lonely } that might be 3000-10,000 lines of code away
2. avoids requiring
On Sunday, 10 August 2014 at 17:29:24 UTC, Walter Bright wrote:
1. labels
2. case statements
3. default statements
4. ?: expressions
and overloading this with more meanings is, in my
not-so-humble-opinion, not a good idea given the very marginal
benefit it might have.
5. Access
On 08/10/2014 08:34 PM, Era Scarecrow wrote:
Although I'm not sure how much it adds for complexity to the compiler
(if any).
It is a trivial change in the parser.
On Sunday, 10 August 2014 at 18:56:40 UTC, Timon Gehr wrote:
On 08/10/2014 08:34 PM, Era Scarecrow wrote:
Although I'm not sure how much it adds for complexity to the
compiler (if any).
It is a trivial change in the parser.
Then I'd say give it a try on a branch and see how it performs
On 8/10/2014 11:34 AM, Era Scarecrow wrote:
On Sunday, 10 August 2014 at 17:29:24 UTC, Walter Bright wrote:
1. labels
2. case statements
3. default statements
4. ?: expressions
and overloading this with more meanings is, in my not-so-humble-opinion, not a
good idea given the very marginal
On Sunday, 10 August 2014 at 20:12:56 UTC, Walter Bright wrote:
On 8/10/2014 11:34 AM, Era Scarecrow wrote:
5. Access permissions (public/private/protected).
6. File length attributes (@safe: @system: @trusted:)
Again, that is for declarations, not statements.
Does with have to be only
On Saturday, 9 August 2014 at 20:04:13 UTC, Timothee Cour via
Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in '
digitalmars-d-le...@puremagic.com' forum
There's already an implementation proposed.
If this is going to be accepted I will most likely resort to
DScanner rule
On Sunday, 10 August 2014 at 23:16:57 UTC, Dicebot wrote:
If this is going to be accepted I will most likely resort to
DScanner rule that statically prohibits it, don't like such
features. Even attribute: syntax can easily result in code
obfuscation and should be used with caution - and this
On Sunday, 10 August 2014 at 23:29:17 UTC, Era Scarecrow wrote:
On Sunday, 10 August 2014 at 23:16:57 UTC, Dicebot wrote:
If this is going to be accepted I will most likely resort to
DScanner rule that statically prohibits it, don't like such
features. Even attribute: syntax can easily result
On 8/10/2014 2:01 PM, Era Scarecrow wrote:
On Sunday, 10 August 2014 at 20:12:56 UTC, Walter Bright wrote:
On 8/10/2014 11:34 AM, Era Scarecrow wrote:
5. Access permissions (public/private/protected).
6. File length attributes (@safe: @system: @trusted:)
Again, that is for declarations,
On Monday, 11 August 2014 at 00:23:36 UTC, Walter Bright wrote:
I'd suggest simply:
private alias FlagStates FS;
then use FS.def, etc.
The source code has 400 lines (955-1376) where it uses flags of
one kind or another. Constantly having to add that type of thing
in just fills up space
See email: 'with(Foo):' not allowed, why? in '
digitalmars-d-le...@puremagic.com' forum
There's already an implementation proposed.
28 matches
Mail list logo