Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
August 07, 2012 enum string | ||||
---|---|---|---|---|
| ||||
[code] import std.regex; enum Token : string { Blank = r"\s+" } void main() { const string text = "Foo Bar"; // text.split(regex(Token.Blank)); // don't work const string blank = Token.Blank; text.split(regex(blank)); // work } [/code] Can me somebody explain that? o.O |
August 07, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On 07-Aug-12 21:05, Namespace wrote: > [code] > import std.regex; > > enum Token : string { > Blank = r"\s+" > } > > void main() { > const string text = "Foo Bar"; > > // text.split(regex(Token.Blank)); // don't work > > const string blank = Token.Blank; > text.split(regex(blank)); // work > } > [/code] > > Can me somebody explain that? o.O isSomeString!T regression? See enum & std.traits topic in d.D. Seems like it will work again in 2.061... -- Dmitry Olshansky |
August 07, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Tuesday, 7 August 2012 at 17:14:03 UTC, Dmitry Olshansky wrote:
> On 07-Aug-12 21:05, Namespace wrote:
>> [code]
>> import std.regex;
>>
>> enum Token : string {
>> Blank = r"\s+"
>> }
>>
>> void main() {
>> const string text = "Foo Bar";
>>
>> // text.split(regex(Token.Blank)); // don't work
>>
>> const string blank = Token.Blank;
>> text.split(regex(blank)); // work
>> }
>> [/code]
>>
>> Can me somebody explain that? o.O
>
> isSomeString!T regression? See enum & std.traits topic in d.D.
> Seems like it will work again in 2.061...
-.-
|
August 07, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Tuesday, August 07, 2012 21:14:00 Dmitry Olshansky wrote:
> isSomeString!T regression? See enum & std.traits topic in d.D. Seems like it will work again in 2.061...
Yeah. In 2.060, std.traits doesn't treat enums as their base type for stuff like isSomeString and isIntegral, which is the problem. It's been fixed on github, but it's still broken in 2.060.
- Jonathan M Davis
|
August 08, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Tuesday, 7 August 2012 at 18:31:41 UTC, Jonathan M Davis wrote:
> On Tuesday, August 07, 2012 21:14:00 Dmitry Olshansky wrote:
>> isSomeString!T regression? See enum & std.traits topic in d.D.
>> Seems like it will work again in 2.061...
>
> Yeah. In 2.060, std.traits doesn't treat enums as their base type for stuff
> like isSomeString and isIntegral, which is the problem. It's been fixed on
> github, but it's still broken in 2.060.
>
> - Jonathan M Davis
Which file must i replace with his version from github to solve the problem?
|
August 08, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Wednesday, August 08, 2012 17:58:17 Namespace wrote: > On Tuesday, 7 August 2012 at 18:31:41 UTC, Jonathan M Davis wrote: > > On Tuesday, August 07, 2012 21:14:00 Dmitry Olshansky wrote: > >> isSomeString!T regression? See enum & std.traits topic in d.D. Seems like it will work again in 2.061... > > > > Yeah. In 2.060, std.traits doesn't treat enums as their base > > type for stuff > > like isSomeString and isIntegral, which is the problem. It's > > been fixed on > > github, but it's still broken in 2.060. > > > > - Jonathan M Davis > > Which file must i replace with his version from github to solve the problem? I really wouldn't advise grabbing single files like that. The release was recent enough that it may be okay, but in general, that's just asking for trouble - especially with something as integral as std.traits. But if you really want to, this is the relevant pull request: https://github.com/D-Programming-Language/phobos/pull/739 std.conv, std.format, std.stdio, and std.traits were all changed as part of the fix. - Jonathan M Davis |
August 08, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | > I really wouldn't advise grabbing single files like that. The release was
> recent enough that it may be okay, but in general, that's just asking for
> trouble - especially with something as integral as std.traits. But if you
> really want to, this is the relevant pull request:
>
> https://github.com/D-Programming-Language/phobos/pull/739
>
> std.conv, std.format, std.stdio, and std.traits were all changed as part of
> the fix.
>
> - Jonathan M Davis
Fails on Win7 with:
Error: don't know how to make '..\druntime\lib\druntime.lib'
Quick question: I've asked that for some time: why is it std.stdio and not std.io?
|
August 08, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Wednesday, August 08, 2012 21:21:38 Namespace wrote:
> Quick question: I've asked that for some time: why is it std.stdio and not std.io?
I don't remember. Probably because it's stdio.h in C/C++.
But Steven Schveighoffer is working on a replacement for it which will probably be named std.io. So, in the long run, that's probably what we'll end up with.
- Jonathan M Davis
|
August 08, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | And why ends my compilation with this error? To cast any Token is _very_ annoying. -.- |
August 09, 2012 Re: enum string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Namespace | On Thursday, August 09, 2012 01:21:29 Namespace wrote: > And why ends my compilation with this error? You're going to need to build both druntime and Phobos if you want to build Phobos. I don't know what's in the zip file, since I haven't used it in ages, so I don't know if you can build them from what's in there or whether you need to actually grab them from github. > To cast any Token is _very_ annoying. -.- I have no idea what you're talking about. - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation