Re: Code fails with linker error. Why?

2014-10-06 Thread eles via Digitalmars-d-learn
On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin wrote: On Saturday, 4 October 2014 at 11:19:52 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 04 Oct 2014 11:01:28 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Saturday, 4 October 2014 at

Re: Curl - Set cookie value

2014-10-06 Thread andre via Digitalmars-d-learn
I found out the real issue. Using addRequestHeader also works for cookies, but there is an issue with HTTP attribute responseHeaders. As this attribute is an associative array (string[string]) it contains only 1 value for 1 key. In case there are several HTTP keys with the same name, it only

Re: curl and proxy

2014-10-06 Thread Sag Academy via Digitalmars-d-learn
On Friday, 3 October 2014 at 10:53:27 UTC, Marc Schütz wrote: On Friday, 3 October 2014 at 04:57:28 UTC, AntonSotov wrote: auto http = HTTP(dlang.org); http.onReceive = (ubyte[] data) { writeln(cast(string) (data)); return data.length; }; http.proxy = 192.168.111.111; http.proxyPort

array append result type

2014-10-06 Thread John Colvin via Digitalmars-d-learn
string a; char[] b; pragma(msg, typeof(a ~ b)); // char[] why not string? What are the rules that determine this?

Re: array append result type

2014-10-06 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 6 October 2014 at 11:28:16 UTC, John Colvin wrote: string a; char[] b; pragma(msg, typeof(a ~ b)); // char[] why not string? What are the rules that determine this? *Ideally*, I'd have said it returns char[], so that you can chose via purity. However, it's not pure, so that

Re: Code fails with linker error. Why?

2014-10-06 Thread John Colvin via Digitalmars-d-learn
On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote: On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin wrote: On Saturday, 4 October 2014 at 11:19:52 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 04 Oct 2014 11:01:28 + John Colvin via Digitalmars-d-learn

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread Nicolas F. via Digitalmars-d-learn
Unicode is hard to deal with properly as how you deal with it is very context dependant. One grapheme is a visible character and consists of one or more codepoints. One codepoint is one mapping of a byte sequence to a meaning, and consists of one or more bytes. This you do not want to deal with

Template Mixin Conflicts

2014-10-06 Thread Alice via Digitalmars-d-learn
Hi, I've created a template mixin which contains a struct definition. The template is meant to be mixed into each module - to provide a little bit of auto generated info in each module - generated at compile time. As soon as I reference the symbols in any context, it starts complaining

Re: Code fails with linker error. Why?

2014-10-06 Thread eles via Digitalmars-d-learn
On Monday, 6 October 2014 at 11:54:56 UTC, John Colvin wrote: On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote: On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin wrote: On Saturday, 4 October 2014 at 11:19:52 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 04 Oct 2014 11:01:28

Re: Template Mixin Conflicts

2014-10-06 Thread Alice via Digitalmars-d-learn
And just this second I found this... but it's a few months old and has no follow up. http://forum.dlang.org/thread/mailman.1054.1398548687.2763.digitalmars-d-b...@puremagic.com On Monday, 6 October 2014 at 12:17:01 UTC, Alice wrote: Hi, I've created a template mixin which contains a struct

Re: Code fails with linker error. Why?

2014-10-06 Thread ketmar via Digitalmars-d-learn
On Mon, 06 Oct 2014 11:54:55 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I disagree. It's simple and easy to understand. and hackish. This is the only genuine problem I can see that requires a language extension. Separating class definition from method

Re: Code fails with linker error. Why?

2014-10-06 Thread John Colvin via Digitalmars-d-learn
On Monday, 6 October 2014 at 12:16:14 UTC, eles wrote: On Monday, 6 October 2014 at 11:54:56 UTC, John Colvin wrote: On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote: On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin wrote: On Saturday, 4 October 2014 at 11:19:52 UTC, ketmar via

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread Kagamin via Digitalmars-d-learn
On Sunday, 5 October 2014 at 12:09:34 UTC, Uranuz wrote: Maybe there is some idea how to just detect first code unit of grapheme without overhead for using Grapheme struct? I just tried to check if ch 128 (for UTF-8). But this dont work. How to check if byte is continuation of code for single

Re: Template Mixin Conflicts

2014-10-06 Thread Alice via Digitalmars-d-learn
btw, do you mind to fill a bugreport? Okay, will do so once I get home from work. Thanks for the scope tip. Will try that out later too.

Re: Code fails with linker error. Why?

2014-10-06 Thread John Colvin via Digitalmars-d-learn
On Monday, 6 October 2014 at 12:36:41 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 06 Oct 2014 11:54:55 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I disagree. It's simple and easy to understand. and hackish. D is very amenable to slightly

Re: Code fails with linker error. Why?

2014-10-06 Thread ketmar via Digitalmars-d-learn
On Mon, 06 Oct 2014 15:44:34 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I disagree. It's simple and easy to understand. and hackish. D is very amenable to slightly hackish code. D allows to write hackish code, and it's good. but if we can provide a way

Re: Code fails with linker error. Why?

2014-10-06 Thread eles via Digitalmars-d-learn
On Monday, 6 October 2014 at 15:44:36 UTC, John Colvin wrote: On Monday, 6 October 2014 at 12:36:41 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 06 Oct 2014 11:54:55 + John Colvin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I disagree. It's simple and easy to

Re: Code fails with linker error. Why?

2014-10-06 Thread eles via Digitalmars-d-learn
On Monday, 6 October 2014 at 13:23:55 UTC, John Colvin wrote: On Monday, 6 October 2014 at 12:16:14 UTC, eles wrote: On Monday, 6 October 2014 at 11:54:56 UTC, John Colvin wrote: On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote: On Saturday, 4 October 2014 at 15:29:57 UTC, John Colvin

Re: array append result type

2014-10-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/6/14 7:28 AM, John Colvin wrote: string a; char[] b; pragma(msg, typeof(a ~ b)); // char[] why not string? It really should be whatever you want. a ~ b is going to generate a completely unique independent copy of a and b. What are the rules that determine this? Not sure. I would

Re: array append result type

2014-10-06 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 6 October 2014 at 16:38:37 UTC, Steven Schveighoffer wrote: I filed this ER ages ago: https://issues.dlang.org/show_bug.cgi?id=1654 Not sure if anyone has it on their radar at this point. -Steve I didn't read the whole thing, but wouldn't purity be a major game changer for 1654?

Re: Code fails with linker error. Why?

2014-10-06 Thread John Colvin via Digitalmars-d-learn
On Monday, 6 October 2014 at 16:02:40 UTC, eles wrote: On Monday, 6 October 2014 at 13:23:55 UTC, John Colvin wrote: On Monday, 6 October 2014 at 12:16:14 UTC, eles wrote: On Monday, 6 October 2014 at 11:54:56 UTC, John Colvin wrote: On Monday, 6 October 2014 at 10:10:04 UTC, eles wrote: On

Search Engine

2014-10-06 Thread ANtlord via Digitalmars-d-learn
Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have met a problem. I can't find search engine. I use xapian always. It has API for several languages, but except D. I

Re: array append result type

2014-10-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/6/14 1:01 PM, monarch_dodra wrote: On Monday, 6 October 2014 at 16:38:37 UTC, Steven Schveighoffer wrote: I filed this ER ages ago: https://issues.dlang.org/show_bug.cgi?id=1654 Not sure if anyone has it on their radar at this point. -Steve I didn't read the whole thing, but wouldn't

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread Uranuz via Digitalmars-d-learn
Have a look here [1]. For example, if you have a byte that is between U+0080 and U+07FF you know that you need two bytes to get that whole code point. [1] http://en.wikipedia.org/wiki/UTF-8#Description Thanks. I solved it myself already for UTF-8 encoding. There choosed approach with

Re: Template Mixin Conflicts

2014-10-06 Thread Ali Çehreli via Digitalmars-d-learn
On 10/06/2014 05:50 AM, ketmar via Digitalmars-d-learn wrote: On Mon, 06 Oct 2014 12:17:00 + Alice via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: the joy of mixin bugs, yeah! it's a bug in compiler: it instantiates mixin in invalid scope. for now you can use string mixins,

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread ketmar via Digitalmars-d-learn
On Mon, 06 Oct 2014 17:28:43 + Uranuz via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: If it is true it means that first byte of sequence found and I can count them. Am I right that it equals to number of graphemes, or are there some exceptions from this rule? alot. take

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Oct 06, 2014 at 05:28:43PM +, Uranuz via Digitalmars-d-learn wrote: Have a look here [1]. For example, if you have a byte that is between U+0080 and U+07FF you know that you need two bytes to get that whole code point. [1] http://en.wikipedia.org/wiki/UTF-8#Description

Re: array append result type

2014-10-06 Thread Ali Çehreli via Digitalmars-d-learn
On 10/06/2014 04:40 AM, monarch_dodra wrote: On Monday, 6 October 2014 at 11:28:16 UTC, John Colvin wrote: string a; char[] b; pragma(msg, typeof(a ~ b)); // char[] why not string? What are the rules that determine this? *Ideally*, I'd have said it returns char[], so that you can chose via

Re: How to detect start of Unicode symbol and count amount of graphemes

2014-10-06 Thread anonymous via Digitalmars-d-learn
On Monday, 6 October 2014 at 17:28:45 UTC, Uranuz wrote: ( str[index] 0b1000 ) == 0 || ( str[index] 0b1110 ) == 0b1100 || ( str[index] 0b ) == 0b1110 || ( str[index] 0b1000 ) == 0b If it is true it means that first byte of sequence found and I can count

Re: Search Engine

2014-10-06 Thread yawniek via Digitalmars-d-learn
On Monday, 6 October 2014 at 17:11:51 UTC, ANtlord wrote: Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have met a problem. I can't find search engine. I use xapian

Re: Code fails with linker error. Why?

2014-10-06 Thread John Colvin via Digitalmars-d-learn
On Monday, 6 October 2014 at 16:04:02 UTC, eles wrote: On Monday, 6 October 2014 at 15:44:36 UTC, John Colvin wrote: On Monday, 6 October 2014 at 12:36:41 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 06 Oct 2014 11:54:55 + John Colvin via Digitalmars-d-learn

Re: Code fails with linker error. Why?

2014-10-06 Thread eles via Digitalmars-d-learn
On Monday, 6 October 2014 at 19:03:13 UTC, John Colvin wrote: On Monday, 6 October 2014 at 16:04:02 UTC, eles wrote: On Monday, 6 October 2014 at 15:44:36 UTC, John Colvin wrote: On Monday, 6 October 2014 at 12:36:41 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 06 Oct 2014 11:54:55

slidingSplitter + retro

2014-10-06 Thread Nordlöw
I've almost satisfied with my new range slidingSplitter at https://github.com/nordlow/justd/blob/master/range_ex.d#L19 All unittest work as expected except my radial test https://github.com/nordlow/justd/blob/master/range_ex.d#L243 which, I believe, incorrectly prints Tuple!(int[],

Re: slidingSplitter + retro

2014-10-06 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 6 October 2014 at 20:06:41 UTC, Nordlöw wrote: I've almost satisfied with my new range slidingSplitter at https://github.com/nordlow/justd/blob/master/range_ex.d#L19 All unittest work as expected except my radial test https://github.com/nordlow/justd/blob/master/range_ex.d#L243

coding practices: include whole module or only the needed function

2014-10-06 Thread AsmMan via Digitalmars-d-learn
Which practice do you use: if you need only one or two functions from a module: import myModule : func, func2; or (import whole module, assuming no function name conflits of course) import myModule; any words why one over the other are welcome. I like the first one why it explicitly show

Re: slidingSplitter + retro

2014-10-06 Thread Nordlöw
On Monday, 6 October 2014 at 21:15:10 UTC, monarch_dodra wrote: I don't have time to investigate tonight, and it's probably not it, but your save isn't saving _upper. I don't know how your radial works. Does the first back print ([1, 2, 3], []) as it should? I've added some extra asserts in

Re: slidingSplitter + retro

2014-10-06 Thread Nordlöw
On Monday, 6 October 2014 at 21:15:10 UTC, monarch_dodra wrote: I don't have time to investigate tonight, and it's probably not it, but your save isn't saving _upper. No, that wasn't the current problem. Thanks for catching it anyway.

Re: slidingSplitter + retro

2014-10-06 Thread Nordlöw
On Monday, 6 October 2014 at 21:15:10 UTC, monarch_dodra wrote: I don't know how your radial works. Does the first back print ([1, 2, 3], []) as it should? I nailed it! The problem was the definition of opSlice. I had to add an extra internal state lower == upper + 1 to represent

Re: coding practices: include whole module or only the needed function

2014-10-06 Thread bearophile via Digitalmars-d-learn
AsmMan: import myModule : func, func2; I use this in D to know what I have imported and where is was imported from. Bye, bearophile

Re: coding practices: include whole module or only the needed function

2014-10-06 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Oct 06, 2014 at 09:24:54PM +, AsmMan via Digitalmars-d-learn wrote: Which practice do you use: if you need only one or two functions from a module: import myModule : func, func2; or (import whole module, assuming no function name conflits of course) import myModule; any

Re: slidingSplitter + retro

2014-10-06 Thread Nordlöw
On Monday, 6 October 2014 at 22:11:50 UTC, Nordlöw wrote: https://github.com/nordlow/justd/blob/master/range_ex.d#L18 One more thing: I'm unsure how the indexes lower and upper should be treated for narrow strings. Should an index represent a code point or a code unit? I'm not sure. In