Any library with string encoding/decoding support?

2014-01-20 Thread ilya-stromberg
Do you know any library with string encoding/decoding support? I need more encodings than provides `std.encoding`.

Re: struct postblit not called, but still destructed

2014-01-20 Thread Maxim Fomin
On Sunday, 19 January 2014 at 20:46:06 UTC, monarch_dodra wrote: I think the behavior is not *strictly* incorrect: When you write: sup = a; it triggers a postblit of "a" into "sup". To do said postblit, you destroy sup. It's the way it works :/ Arguably, since it is initialization, we coul

Re: Array of pointers

2014-01-20 Thread Gary Willoughby
On Saturday, 18 January 2014 at 14:57:39 UTC, Arjan Fetahu wrote: I have some experience with C experience, so I still have to learn tamplates. Thaks for the help. Arjan Here's a handy introduction: http://nomad.so/2013/07/templates-in-d-explained/

Re: Array of pointers

2014-01-20 Thread Andrej Mitrovic
On 1/16/14, Philippe Sigaud wrote: > The thing is, an array is a reference type Actually it's not, let's not confuse people with the terminology here. To recap for people new to arrays: an array in D is really just a struct, e.g.: struct Array { int* data; size_t length; } Array myArray

Re: Why is string.front dchar?

2014-01-20 Thread Jakob Ovrum
On Thursday, 16 January 2014 at 06:59:43 UTC, Maxim Fomin wrote: This is wrong. String in D is de facto (by implementation, spec may say whatever is convenient for advertising D) array of single bytes which can keep UTF-8 code units. No way string type in D is always a string in a sense of code

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
On Sat, 18 Jan 2014 11:33:16 +, Kagamin wrote: On Friday, 17 January 2014 at 12:52:09 UTC, Hugo Florentino wrote: On Fri, 17 Jan 2014 07:07:35 +, Kagamin wrote: Does it fail for that one directory only or for any directory? Interesting question. I would have to do more tests with odd

Re: Why is string.front dchar?

2014-01-20 Thread Maxim Fomin
On Monday, 20 January 2014 at 09:58:07 UTC, Jakob Ovrum wrote: On Thursday, 16 January 2014 at 06:59:43 UTC, Maxim Fomin wrote: This is wrong. String in D is de facto (by implementation, spec may say whatever is convenient for advertising D) array of single bytes which can keep UTF-8 code units

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
On Sat, 18 Jan 2014 11:51:48 +, Kagamin wrote: remove uses DeleteFile, but MSDN says To remove an empty directory, use the RemoveDirectory function. so remove probably won't work on directories. You are correct, so I made a few test using rmdir() with a blank for directory name and now I

Re: errors with filesystem operations

2014-01-20 Thread Hugo Florentino
Update: the combination of both your suggestions worked: if (exists(BlankDirToDelete)) { try rmdir(`\\?\` ~ BlankDirToDelete); catch (FileException e) writeln(e.msg); } Thanks! Now I just have to find out why the block of the file extensions is failing.

Re: Why is string.front dchar?

2014-01-20 Thread Tobias Pankrath
Same reasons which prevent sane person from being OK with int[] number = [3.14l] should prevent him from being OK with string s = "säд" No, since this literal can be encoded as utf8 just fine. Keep in mind that literals are nothing else as values written directly into the source. And as is ha

Re: Any library with string encoding/decoding support?

2014-01-20 Thread Adam D. Ruppe
On Monday, 20 January 2014 at 08:33:09 UTC, ilya-stromberg wrote: Do you know any library with string encoding/decoding support? I need more encodings than provides `std.encoding`. I did one that does a little bit more decoding, but no encoding support at all. (I wrote it for my web scraper an

Re: Any library with string encoding/decoding support?

2014-01-20 Thread MGW
On Monday, 20 January 2014 at 08:33:09 UTC, ilya-stromberg wrote: Do you know any library with string encoding/decoding support? I need more encodings than provides `std.encoding`. Library to work with Qt. https://github.com/MGWL/QtE-Qt_for_Dlang_and_Forth Working with Qt and its QTextCodec c

Re: Why is string.front dchar?

2014-01-20 Thread Jakob Ovrum
On Monday, 20 January 2014 at 13:30:11 UTC, Tobias Pankrath wrote: (w|d)string.length returning anything else then the number of underlying code points would be inconsistent to other array types and m aking (d|w)string arrays of code points was a (arguably good) design decision. Code units, n

Re: Why is string.front dchar?

2014-01-20 Thread Tobias Pankrath
On Monday, 20 January 2014 at 16:53:32 UTC, Jakob Ovrum wrote: On Monday, 20 January 2014 at 13:30:11 UTC, Tobias Pankrath wrote: (w|d)string.length returning anything else then the number of underlying code points would be inconsistent to other array types and making (d|w)string arrays of code

Generic Span/Limits/MinMax Type

2014-01-20 Thread Nordlöw
Has anyone cooked up a generic D struct that groups together min and max values of a type and default-initializes them in the correct way? Something like struct Limits(T) { /* TODO: Fix purity of this by fixing Bytes.value() */ auto init() @trusted /* pure */ nothrow

Re: Array of pointers

2014-01-20 Thread Ali Çehreli
On 01/20/2014 01:58 AM, Andrej Mitrovic wrote: > On 1/16/14, Philippe Sigaud wrote: >> The thing is, an array is a reference type > > Actually it's not, let's not confuse people with the terminology here. > To recap for people new to arrays: an array in D is really just a > struct, e.g.: > > str

Re: Array of pointers

2014-01-20 Thread Philippe Sigaud
On Mon, Jan 20, 2014 at 10:58 AM, Andrej Mitrovic wrote: > On 1/16/14, Philippe Sigaud wrote: >> The thing is, an array is a reference type > > Actually it's not, let's not confuse people with the terminology here. > To recap for people new to arrays: an array in D is really just a > struct, e.g.

Re: Generic Span/Limits/MinMax Type

2014-01-20 Thread sclytrack
On Monday, 20 January 2014 at 19:36:13 UTC, Nordlöw wrote: Has anyone cooked up a generic D struct that groups together min and max values of a type and default-initializes them in the correct way? Something like struct Limits(T) { /* TODO: Fix purity of this by fixing Bytes.