Re: Voting: std.logger

2014-09-02 Thread Kevin Lamonte via Digitalmars-d
On Tuesday, 2 September 2014 at 14:53:17 UTC, Dicebot wrote: This is exactly what I call theoretical speculations. Please provide specific list like this: 1) some method signature needs to be changed I propose the following API changes (+ changes on default implementation): protected

Re: [OT] Microsoft filled patent applications for scoped and immutable types

2014-09-02 Thread Paolo Invernizzi via Digitalmars-d
On Tuesday, 2 September 2014 at 21:00:53 UTC, Nick Sabalausky wrote: On 9/2/2014 4:10 PM, Walter Bright wrote: They said this is an ex partae thing, where until the patent is granted, I am not allowed to be part of the process. Only after a patent is granted can I file a prior art notice.

Comparing TypeTuples

2014-09-02 Thread Tudor Berariu via Digitalmars-d-learn
How can I check if two TypeTuples containing both types and values are the same? This fails: static assert(is(TypeTuple!(3, int, Zorro) == TypeTuple!(3, int, Zorro))); Thank you! Tudor

Re: Comparing TypeTuples

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 08:27:14 UTC, Tudor Berariu wrote: How can I check if two TypeTuples containing both types and values are the same? This fails: static assert(is(TypeTuple!(3, int, Zorro) == TypeTuple!(3, int, Zorro))); Thank you! Tudor Yeah, this fails because you can't

Re: Implementing Template Restrictions in Different Way

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 1 September 2014 at 22:46:52 UTC, Nordlöw wrote: Is this a other/newer preferred way to describe the template restriction, using for example __traits(compiles, ...)? Is is(typeof(... AFAIK, those produce the same results 99% of the time. The only cases where they differ are

Re: Implementing Template Restrictions in Different Way

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 1 September 2014 at 22:46:52 UTC, Nordlöw wrote: BTW: Is there a way to prevent the calls to r1.length and r2.length in this case? Also, this assumes your ranges have front at all. AFAIK, skipOver operates on forward ranges. Related: Your condition could fail if R1/R2 are strings

Re: Implementing Template Restrictions in Different Way

2014-09-02 Thread Nordlöw
On Tuesday, 2 September 2014 at 10:22:49 UTC, monarch_dodra wrote: the fastest way to do this? Are you talking about constraints, or implementation of safeSkipOver? The constraint. Hum... Are you writing this function because skipOver will actually fail? AFAIK, it shouldn't. We should fix

Re: Implementing Template Restrictions in Different Way

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 11:41:51 UTC, Nordlöw wrote: On Tuesday, 2 September 2014 at 10:22:49 UTC, monarch_dodra wrote: the fastest way to do this? Are you talking about constraints, or implementation of safeSkipOver? The constraint. In that case, I'm not sure what you mean by

Re: Implementing Template Restrictions in Different Way

2014-09-02 Thread Nordlöw
On Tuesday, 2 September 2014 at 12:14:01 UTC, monarch_dodra wrote: In that case, I'm not sure what you mean by fastest in the context of constraints, which are compile-time. With performance I mean compilation speed. I think so yes. That's the R/E version though. Is the R/R version also

Overriding to!string on enum types

2014-09-02 Thread Nordlöw
Is it possible to override the behaviour of to!string(x) when x is an enum. I'm asking because this enum CxxRefQualifier { none, normalRef, rvalueRef } string toString(CxxRefQualifier refQ) @safe pure nothrow { final switch (refQ) { case CxxRefQualifier.none: return

Re: Overriding to!string on enum types

2014-09-02 Thread evilrat via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 12:54:55 UTC, Nordlöw wrote: Is it possible to override the behaviour of to!string(x) when x is an enum. I'm asking because this enum CxxRefQualifier { none, normalRef, rvalueRef } string toString(CxxRefQualifier refQ) @safe pure nothrow { final

Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
How do I read unicode chars that has code points \u1FFF and higher from a file? file.getcw() reads only part of the char, and D identifies this character as an array of three or four characters. Importing std.uni does not change the behavior. Thank you.

Re: Overriding to!string on enum types

2014-09-02 Thread evilrat via Digitalmars-d-learn
sorry, i forgot everything. here is example of how to do this - import std.conv : to; enum Test { One, Two, Three, } template to(T: string) { T to(A: Test)(A val) { final switch (val) { case Test.One: return 1; case Test.Two: return 2; case Test.Three: return 3; } } }

Re: Overriding to!string on enum types

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 14:59:41 UTC, evilrat wrote: sorry, i forgot everything. here is example of how to do this - import std.conv : to; enum Test { One, Two, Three, } template to(T: string) { T to(A: Test)(A val) { final switch (val) { case Test.One: return 1;

Re: Overriding to!string on enum types

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 12:54:55 UTC, Nordlöw wrote: Is it possible to override the behaviour of to!string(x) when x is an enum. I'm asking because this enum CxxRefQualifier { none, normalRef, rvalueRef } string toString(CxxRefQualifier refQ) @safe pure nothrow { final

Re: Overriding to!string on enum types

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 15:41:17 UTC, monarch_dodra wrote: Unless we allow defining enum-member functions, AFAIK, it is impossible to override the printing behavior for enums... ... If your enum actually represents strings, then you could: enum CxxRefQualifier : string { none

Re: Overriding to!string on enum types

2014-09-02 Thread evilrat via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 15:42:36 UTC, monarch_dodra wrote: Word of warning: You are not overriding to, but rather, simply defining your own to locally, which resolves as a better match in the context where you are using it. If you pass the enum to another function in another module,

Re: Reading unicode chars..

2014-09-02 Thread Andrew Godfrey via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 14:06:04 UTC, seany wrote: How do I read unicode chars that has code points \u1FFF and higher from a file? file.getcw() reads only part of the char, and D identifies this character as an array of three or four characters. Importing std.uni does not change the

Re: I can ask questions about dmd on windows here in this forum?

2014-09-02 Thread Kagamin via Digitalmars-d-learn
On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: D program should just use string unless it needs random-access, in which case, it should use dstring. Except that dstring is not fool-proof either when one needs to work at grapheme level.

Re: Query Parser Callstack

2014-09-02 Thread Kagamin via Digitalmars-d-learn
You can try to create an exception and get stack trace from it. The functionality is in druntime.

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 07:06 AM, seany wrote: How do I read unicode chars that has code points \u1FFF and higher from a file? file.getcw() reads only part of the char, and D identifies this character as an array of three or four characters. Importing std.uni does not change the behavior. Thank you.

Re: Query Parser Callstack

2014-09-02 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 1 September 2014 at 21:00:46 UTC, Nordlöw wrote: Are there some nice traits or internals to query the current call stack for address or perhaps even their (mangled) names. I'm mostly interested in using this to detect infinite recursions in my recursive descent parser. This provided

Re: Reading unicode chars..

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 17:10:57 UTC, Ali Çehreli wrote: 1) To avoid a common gotcha, note that 'line' is reused at every iteration here. You must make copies of portions of it if you need to. Ali I don't know if you are aware, but byLineCopy was recently introduced. It will be

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Hi Ali, i know this example from your book. But try to capture „ the low quotation mark, appearing in the All-purpose punctuations plane of unicode, with \u201e - I worte I am having problems with \u1FFF and up. This particular symbol, is seen as a dchar array \x1e\x20 - so two dchars,

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Linux 64 bit, D2, phobos only.

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 11:11 AM, seany wrote: But try to capture „ the low quotation mark, appearing in the All-purpose punctuations plane of unicode, with \u201e - I worte I am having problems with \u1FFF and up. You are doing it differently. Can you show us a minimal example? Otherwise, there is

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 18:22:54 UTC, Ali Çehreli wrote: That would happen when you you treat the chars on the input and individual dchars. That is precisely where the problem is. If you use the character in a file, and then open it as a stream, then use File.getc() or

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Your example reads the file by lines, i need to get them by chars.

Get operator overloads

2014-09-02 Thread Ivan Timokhin via Digitalmars-d-learn
Is it possible to get all overloads of an operator for a particular type? I.e., having this struct definition, is it possible to tell at compile time that it can be added with double and int[]? struct S { void opBinary(string op : +)(double); void opBinary(string op : +)(int[]); } To

Re: Get operator overloads

2014-09-02 Thread via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 18:55:50 UTC, Ivan Timokhin wrote: Is it possible to get all overloads of an operator for a particular type? I.e., having this struct definition, is it possible to tell at compile time that it can be added with double and int[]? struct S { void

Re: I can ask questions about dmd on windows here in this forum?

2014-09-02 Thread Cassio Butrico via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote: On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: D program should just use string unless it needs random-access, in which case, it should use dstring. Except that dstring is not fool-proof

Re: Query Parser Callstack

2014-09-02 Thread Nordlöw
On Tuesday, 2 September 2014 at 18:10:19 UTC, Gary Willoughby wrote: I've no idea how it is used but '_d_traceContext' might be of use: Ok, thanks. I just realized that http://code.dlang.org/packages/backtrace-d might be of use here aswell.

Re: I can ask questions about dmd on windows here in this forum?

2014-09-02 Thread Cassio Butrico via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 20:12:12 UTC, Cassio Butrico wrote: On Tuesday, 2 September 2014 at 16:49:15 UTC, Kagamin wrote: On Sunday, 31 August 2014 at 08:37:40 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: D program should just use string unless it needs random-access, in which

Re: Reading unicode chars..

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 18:30:55 UTC, seany wrote: Your example reads the file by lines, i need to get them by chars. If you are intent on reading the stream character (or wcharacter) 1 by 1, then you will have to decode them manually, as there is no getcd. Unfortunately, the newer

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 02:13 PM, monarch_dodra wrote: I'd suggest you create a range out of your std.stream.File, which reads it byte by byte. I was in the process of doing just that. Then, you pass it to the byDchar() range, which will auto decode those characters. If you really want to do it

Re: D1: Error: duplicate union initialization for size

2014-09-02 Thread jicman via Digitalmars-d-learn
On Monday, 1 September 2014 at 15:44:50 UTC, Dicebot wrote: On Sunday, 31 August 2014 at 03:06:48 UTC, Dicebot wrote: My guess is that it hasn't been ported to the D1 compiler yet. Dicebot or any other people who work for Sociomantic should be most helpful. At this point, I recommend that you

Question about 'this'

2014-09-02 Thread Joel via Digitalmars-d-learn
string getString2(in string input) { long start, end; while(start input.length input[start] != '') start++; start++; end = input.length - 1; while(end 0 input[end] != '')

Re: Question about 'this'

2014-09-02 Thread Joel via Digitalmars-d-learn
On Wednesday, 3 September 2014 at 04:00:30 UTC, Joel wrote: string getString2(in string input) { long start, end; while(start input.length input[start] != '') start++; start++; end = input.length -

Re: const-correctness in std.range

2014-09-02 Thread Vlad Levenfeld via Digitalmars-d-learn
Thanks for the reply. And indeed, I recently found that ByLine.empty can't be const because it writes and removes a character from the stream or something... and when I compile with optimizations, const empty gets totally wrecked. I suppose that making empty const doesn't really gain me

Template instantiation and string vs const char[]

2014-09-02 Thread Jason den Dulk via Digitalmars-d-learn
I have this piece of code: template somet(R...) { static if (R.length) { string somet = [\n~R[0]~\n ~ somet!(R[1..R.length]) ~ ]\n; } else string somet = ; } void main() { writeln(somet!(name,tame)); writeln(somet!name); } When I compile it, it generates the error

[Issue 13410] Performance problem with associative array byKey/byValue

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13410 safety0ff.bugz safety0ff.b...@gmail.com changed: What|Removed |Added CC|

[Issue 13410] Performance problem with associative array byKey/byValue

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13410 --- Comment #11 from Ketmar Dark ket...@ketmar.no-ip.org --- (In reply to bearophile_hugs from comment #9) Right. (But using an unordered_map in the C++ code from the newsgroup the C++ code only gets a little more than twice slower, that seems

[Issue 13416] frequent auto-tester hangs in core.thread on freebsd 32 and 64

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13416 Brad Roberts bra...@puremagic.com changed: What|Removed |Added Hardware|x86_64 |All

[Issue 13410] Performance problem with associative array byKey/byValue

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13410 --- Comment #12 from Ketmar Dark ket...@ketmar.no-ip.org --- (In reply to safety0ff.bugz from comment #10) As for ketmar's patch, I don't think we should introduce a slowdown in _aaDelX. cache bookkeeping turns on only when the code used

[Issue 13410] Performance problem with associative array byKey/byValue

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13410 --- Comment #13 from safety0ff.bugz safety0ff.b...@gmail.com --- (In reply to Ketmar Dark from comment #12) cache bookkeeping turns on only when the code used byKey/byValue at least once (i.e. directly or in foreach loop). this is not that frequent

[Issue 13388] accept '@' before 'nothrow' and 'pure'

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13388 --- Comment #27 from Don clugd...@yahoo.com.au --- (In reply to Jonathan M Davis from comment #14) I really think that we've passed the point where it's worth fixing it. NO This attitude is the biggest problem D has. Please, watch Scott

[Issue 13083] using map() with a delegate which uses a ref parameter to the enclosing scope is broken when compiling with -inline (sample code attached)

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13083 Denis Shelomovskij verylonglogin@gmail.com changed: What|Removed |Added Keywords||wrong-code

[Issue 13244] Wrong code with -inline and foreach/map/all

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13244 Denis Shelomovskij verylonglogin@gmail.com changed: What|Removed |Added CC|

[Issue 13286] -inline and a library results in application failing to launch

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13286 Denis Shelomovskij verylonglogin@gmail.com changed: What|Removed |Added CC|

[Issue 13083] using map() with a delegate which uses a ref parameter to the enclosing scope is broken when compiling with -inline (sample code attached)

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13083 --- Comment #1 from Denis Shelomovskij verylonglogin@gmail.com --- Probably duplicates of this one: Issue 13244 Issue 13286. --

[Issue 13388] accept '@' before 'nothrow' and 'pure'

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13388 --- Comment #28 from Jonathan M Davis jmdavisp...@gmx.com --- (In reply to Don from comment #27) (In reply to Jonathan M Davis from comment #14) I really think that we've passed the point where it's worth fixing it. NO This attitude is the

[Issue 13417] New: segmentation fault when deduce template type

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13417 Issue ID: 13417 Summary: segmentation fault when deduce template type Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical

[Issue 13323] UDA applied to import statement causes compilation to fail without error

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13323 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 13323] UDA applied to import statement causes compilation to fail without error

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13323 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7135ddb0d5611462522a20e3b1e15801b045cee5 fix Issue 13323 - UDA

[Issue 13415] [REG2.066] '-inline' causes wrong enclosing scope pointer for nested function called from templated struct

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13415 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e5e8a4ad6b0f9cd7a0bf979c701fe4ff223ffd7c fix Issue 13415 - '-inline'

[Issue 11042] Inconsistent static condition behaviors

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11042 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/296859699b29b1ef562155ba7b4f7558b4b3b616 fix Issue 11042 -

[Issue 11042] Inconsistent static condition behaviors

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11042 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 10158] 'offsetof' property of nested struct does not work properly

2014-09-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10158 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

<    1   2