Re: How my little brother try D

2016-04-02 Thread Walter Bright via Digitalmars-d
On 4/2/2016 2:29 PM, Daniel Kozak wrote: And probably we should fixed copy method to not remove files with same src and dst path :) https://issues.dlang.org/show_bug.cgi?id=15865

[Issue 15865] std.file.copy(from, to) deletes the file if from and to specify the same file

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15865 Walter Bright changed: What|Removed |Added URL|

[Issue 15865] New: std.file.copy(from,to) deletes the file if from and to specify the same file

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15865 Issue ID: 15865 Summary: std.file.copy(from,to) deletes the file if from and to specify the same file Product: D Version: D2 Hardware: All OS: All

Re: How my little brother try D

2016-04-02 Thread jmh530 via Digitalmars-d
On Saturday, 2 April 2016 at 22:54:09 UTC, Lass Safin wrote: You're right in how it isn't obvious for non-techy people. I do suppose it would be doable without breaking any old code (unless for some arcane reason the code depends on static assert(!__traits(allMember,

Re: string to uppercase

2016-04-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 3 April 2016 at 03:05:08 UTC, stunaep wrote: Is there any easy way to convert a string to uppercase? I tried s.asUpperCase, but it returns a ToCaserImpl, not a string, and it cant be cast to string. I also tried toUpper but it wasnt working with strings asUpperCase returns a range

string to uppercase

2016-04-02 Thread stunaep via Digitalmars-d-learn
Is there any easy way to convert a string to uppercase? I tried s.asUpperCase, but it returns a ToCaserImpl, not a string, and it cant be cast to string. I also tried toUpper but it wasnt working with strings

Decompressing bzip2

2016-04-02 Thread stunaep via Digitalmars-d-learn
I am trying to use the bzip2 bindings that are available on code.dlang.org/packages, but I am having a really hard time using it due to the pointers. It needs to be an array once it's decompressed. Here is what I have: import std.stdio; import bzlib; void main(string[] args) { File f =

Re: We gunna be rich

2016-04-02 Thread Charles via Digitalmars-d
On Saturday, 2 April 2016 at 19:12:19 UTC, Suliman wrote: Do you have any plans to public 2 edition of The D Programming Language book? I'd buy it.

Re: We gunna be rich

2016-04-02 Thread Lass Safin via Digitalmars-d
On Saturday, 2 April 2016 at 21:03:28 UTC, Patience wrote: On Saturday, 2 April 2016 at 15:43:53 UTC, Andrei Alexandrescu wrote: Hello all, I've created an Amazon Affiliates link for the D Language Foundation (dlang-20). Subsequently I've changed https://wiki.dlang.org/Books to use it. Please

Re: How my little brother try D

2016-04-02 Thread Lass Safin via Digitalmars-d
On Saturday, 2 April 2016 at 21:29:27 UTC, Daniel Kozak wrote: Few days ago, my little brother (13 years old) ask me about writing some small utility. He needed find all files with selected extensions and move them to some another location. He asked me about using D or C# for it. My answer

How my little brother try D

2016-04-02 Thread Daniel Kozak via Digitalmars-d
Few days ago, my little brother (13 years old) ask me about writing some small utility. He needed find all files with selected extensions and move them to some another location. He asked me about using D or C# for it. My answer was: try both and you will see which one suited you better.

Re: We gunna be rich

2016-04-02 Thread Patience via Digitalmars-d
On Saturday, 2 April 2016 at 15:43:53 UTC, Andrei Alexandrescu wrote: Hello all, I've created an Amazon Affiliates link for the D Language Foundation (dlang-20). Subsequently I've changed https://wiki.dlang.org/Books to use it. Please follow up with changing dlang.org to also use the links,

Re: We gunna be rich

2016-04-02 Thread Pradeep Gowda via Digitalmars-d
On Saturday, 2 April 2016 at 15:43:53 UTC, Andrei Alexandrescu wrote: D Language Foundation (dlang-20). There are a couple of things that we can do to increase awareness of the Foundation and ways to contribute to it: 1. Link to the foundation website. (do we have one?) 2. On the

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 18:32:03 UTC, Steven Schveighoffer wrote: I honestly think you are better off just generating random arrays, even if it results in some overlap (unlikely to be relevant). -Steve Yes I know, I've realized how it's silly. just foreach(xn; 0 .. range) foreach(xn;

Re: We gunna be rich

2016-04-02 Thread Suliman via Digitalmars-d
On Saturday, 2 April 2016 at 15:43:53 UTC, Andrei Alexandrescu wrote: Hello all, I've created an Amazon Affiliates link for the D Language Foundation (dlang-20). Subsequently I've changed https://wiki.dlang.org/Books to use it. Please follow up with changing dlang.org to also use the links,

Re: Address of an element of AA

2016-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/16 10:22 AM, Temtaime wrote: Hi ! I can't find this in specs. If i add an element to AA: aa[10] = 123; Will [10] be always the same (of course i don't remove that key) ? Thanks for a reply. I think specs should be enhanced. Depends on your definition of "always". As long as you don't

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/16 5:47 AM, jkpl wrote: gives: core.exception.OutOfMemoryError@src/core/exception.d(693): Memory allocation failed Probably because randomCover needs to allocate a bool for all the elements it has already covered, so you are allocating 32 * 4G bools. How much RAM do you have? Note

Best way to explicitly control the attributes of a template function

2016-04-02 Thread tsbockman via Digitalmars-d
Jack Stouffer and I have been working on a pull request for Phobos to enable runtime dispatch for field and property access: https://github.com/D-Programming-Language/phobos/pull/4070 (It's useful when directly porting code from dynamic languages like Python.) Working with fields in this

Re: Any reason as to why this isn't allowed?

2016-04-02 Thread Lass Safin via Digitalmars-d
On Saturday, 2 April 2016 at 16:58:14 UTC, Paul O'Neil wrote: On 04/02/2016 09:02 AM, Lass Safin wrote: class C { ~this() {} immutable ~this() {} } This gives a conflict error between the two destructors. What do you expect the difference to be? I'm not sure what I expect

Re: Any reason as to why this isn't allowed?

2016-04-02 Thread Paul O'Neil via Digitalmars-d
On 04/02/2016 09:02 AM, Lass Safin wrote: class C { ~this() {} immutable ~this() {} } This gives a conflict error between the two destructors. What do you expect the difference to be? I'm not sure what I expect the semantics of destroying an immutable object to be.

Re: We gunna be rich

2016-04-02 Thread Jack Stouffer via Digitalmars-d
On Saturday, 2 April 2016 at 15:43:53 UTC, Andrei Alexandrescu wrote: Hello all, I've created an Amazon Affiliates link for the D Language Foundation (dlang-20). Subsequently I've changed https://wiki.dlang.org/Books to use it. Please follow up with changing dlang.org to also use the links,

Re: Could we reserve void[T] for builtin set of T ?

2016-04-02 Thread Andrei Alexandrescu via Digitalmars-d
On 04/01/2016 02:29 PM, Jonathan M Davis via Digitalmars-d wrote: On Friday, April 01, 2016 15:52:49 matovitch via Digitalmars-d wrote: Indeed, just wanted to point that out. (I guess that's why the set was introduced before the unordered one in the c++ stl as well). I feel like containers are

Re: No aa.byKey.length?

2016-04-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, April 02, 2016 15:38:30 Ozan via Digitalmars-d-learn wrote: > On Friday, 1 April 2016 at 20:50:32 UTC, Yuxuan Shui wrote: > > Why? > > > > This is annoying when I need to feed it into a function that > > requires hasLength. > > aa.keys.length That allocates an array. Doing that would

[Issue 9797] to!int() cannot convert hexadecimal numbers

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9797 Jonathan M Davis changed: What|Removed |Added CC|

Re: Can we check the arguments to format() at compile time?

2016-04-02 Thread Andrei Alexandrescu via Digitalmars-d
On 04/01/2016 07:26 PM, Alex Parrill wrote: On Friday, 1 April 2016 at 21:25:46 UTC, Yuxuan Shui wrote: Clang has this nice feature that it will warn you when you passed wrong arguments to printf: #include int main(){ long long u = 10; printf("%c", u); } clang something.c:

We gunna be rich

2016-04-02 Thread Andrei Alexandrescu via Digitalmars-d
Hello all, I've created an Amazon Affiliates link for the D Language Foundation (dlang-20). Subsequently I've changed https://wiki.dlang.org/Books to use it. Please follow up with changing dlang.org to also use the links, and also let me know if you need affiliate links for any other products.

Re: No aa.byKey.length?

2016-04-02 Thread Ozan via Digitalmars-d-learn
On Friday, 1 April 2016 at 20:50:32 UTC, Yuxuan Shui wrote: Why? This is annoying when I need to feed it into a function that requires hasLength. aa.keys.length

Re: Address of an element of AA

2016-04-02 Thread Ozan via Digitalmars-d-learn
On Saturday, 2 April 2016 at 14:22:01 UTC, Temtaime wrote: Hi ! I can't find this in specs. If i add an element to AA: aa[10] = 123; Will [10] be always the same (of course i don't remove that key) ? Thanks for a reply. I think specs should be enhanced. Running following int

[Issue 15859] opApply resolution on attributes

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15859 Kenji Hara changed: What|Removed |Added Keywords||pull, rejects-valid

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread Ali Çehreli via Digitalmars-d-learn
[Probably a repost.] On 04/02/2016 01:20 AM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. nextPermutation(): https://dlang.org/phobos/std_algorithm_sorting.html#nextPermutation Ali

Re: Address of an element of AA

2016-04-02 Thread Ali Çehreli via Digitalmars-d-learn
On 04/02/2016 07:22 AM, Temtaime wrote: Hi ! I can't find this in specs. If i add an element to AA: aa[10] = 123; Will [10] be always the same (of course i don't remove that key) ? Thanks for a reply. I think specs should be enhanced. No, the underlying buffer can be relocated when the hash

Re: Can we check the arguments to format() at compile time?

2016-04-02 Thread Johan Engelen via Digitalmars-d
On Friday, 1 April 2016 at 21:25:46 UTC, Yuxuan Shui wrote: Clang has this nice feature that it will warn you when you passed wrong arguments to printf: #include int main(){ long long u = 10; printf("%c", u); } clang something.c: something.c:4:15: warning: format specifies

Re: "Squash and merge" on GitHub

2016-04-02 Thread Kagamin via Digitalmars-d
Wasn't there the "Committed of behalf" feature?

[Issue 15864] chmgen triggers exception in std.regex

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15864 Dmitry Olshansky changed: What|Removed |Added CC|

Address of an element of AA

2016-04-02 Thread Temtaime via Digitalmars-d-learn
Hi ! I can't find this in specs. If i add an element to AA: aa[10] = 123; Will [10] be always the same (of course i don't remove that key) ? Thanks for a reply. I think specs should be enhanced.

Re: "Squash and merge" on GitHub

2016-04-02 Thread Jonathan M Davis via Digitalmars-d
On Saturday, April 02, 2016 01:18:47 Andrei Alexandrescu via Digitalmars-d wrote: > On 4/2/16 12:36 AM, Jack Stouffer wrote: > > On Saturday, 2 April 2016 at 03:58:27 UTC, Daniel Murphy wrote: > >> On 2/04/2016 7:28 AM, Vladimir Panteleev wrote: > >>> 4. We should use the autotester's auto-merge

Any reason as to why this isn't allowed?

2016-04-02 Thread Lass Safin via Digitalmars-d
class C { ~this() {} immutable ~this() {} } This gives a conflict error between the two destructors.

Re: Units of Measurement Library: units-d

2016-04-02 Thread crimaniak via Digitalmars-d-announce
On Friday, 1 April 2016 at 22:54:53 UTC, Simen Kjaeraas wrote: ... I kinda agree. And looking at https://dlang.org/spec/traits.html, I see there's __MODULE__, which would probably be a better choice than __FILE__. I think adding something like __UNIQUE_NAME__ to predefined constants will

[Issue 15864] New: chmgen triggers exception in std.regex

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15864 Issue ID: 15864 Summary: chmgen triggers exception in std.regex Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: blocker

[Issue 15857] incorrect checkimports mismatch for overload sets

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15857 --- Comment #3 from Jacob Carlborg --- I guess since this is currently only a deprecation it isn't _that_ bad. Would it be realistic to fix the bug before it's turned in to a real error? What is considered equality for a symbol, the

[Issue 15857] incorrect checkimports mismatch for overload sets

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15857 --- Comment #2 from Martin Nowak --- Unfortunately we don't have any complete symbol equality test in the compiler (even __traits(isSame) doesn't completely work), so fixing this bug is a bit out of scope. --

Re: Any usable SIMD implementation?

2016-04-02 Thread Martin Nowak via Digitalmars-d
On 04/02/2016 10:19 AM, Iain Buclaw via Digitalmars-d wrote: >> > __builtin_ia32_loadups >> > __builtin_ia32_storeups > Any agnostic way to... :-) I'm already using vector types for most operations, so it's somewhat portable. But for whatever reason D doesn't allow multiplication/division w/

Re: Can we check the arguments to format() at compile time?

2016-04-02 Thread Jacob Carlborg via Digitalmars-d
On 2016-04-02 01:40, Yuxuan Shui wrote: That's kind of ugly. Now I really wish D can unify template arguments and function arguments known at compile time. Sounds like AST macros. -- /Jacob Carlborg

Re: Could we reserve void[T] for builtin set of T ?

2016-04-02 Thread Jacob Carlborg via Digitalmars-d
On 2016-03-31 21:24, deadalnix wrote: Pretty much as per title. I has that in the back of my mind for a while. Would that work ? An alternative syntax for declaring a set could be: [int] set; Not sure if that conflicts with any existing syntax. -- /Jacob Carlborg

Re: Could we reserve void[T] for builtin set of T ?

2016-04-02 Thread Jacob Carlborg via Digitalmars-d
On 2016-03-31 21:57, Walter Bright wrote: On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote: Ah, makes sense. But what would aa[x] return? A bool indicating membership. And how would you add elements to it? aa[x] = true; // add member x aa[x] = false; // remove member x x in aa;

Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 2 April 2016 at 09:28:58 UTC, ZombineDev wrote: On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
gives: core.exception.OutOfMemoryError@src/core/exception.d(693): Memory allocation failed

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 09:11:34 UTC, jkpl wrote: On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit

Re: pass a struct by value/ref and size of the struct

2016-04-02 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 19:39:49 UTC, kinke wrote: On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's incorrect. As Johan pointed out, this is somewhat true for

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit better: foreach (b0; randomCover(iota(0,256)))

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Actually I'd use a hex string. So: static

[Issue 15863] .length for AA.byKey

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15863 ZombineDev changed: What|Removed |Added Keywords||pull

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Actually I'd use a hex string. So: static ubyte[256] DATA = cast(ubyte[256])x"00 01

Re: Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Currently I fill it for each new test with std.random.uniform but I'm sure that I loose some time with randomizing and with the tests that are repeated. Is

Idiomatic way to generate all possible values a static array of ubyte can have

2016-04-02 Thread jkpl via Digitalmars-d-learn
Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Currently I fill it for each new test with std.random.uniform but I'm sure that I loose some time with randomizing and with the tests that are repeated. Is there a simple way to do this ?

Re: Any usable SIMD implementation?

2016-04-02 Thread Iain Buclaw via Digitalmars-d
On 2 Apr 2016 9:45 am, "Martin Nowak via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On Saturday, 2 April 2016 at 06:13:24 UTC, Iain Buclaw wrote: >> >> I would just let the compiler optimize / vectorize the operation, but then again that it is probably just me who thinks these

Re: "Squash and merge" on GitHub

2016-04-02 Thread Vladimir Panteleev via Digitalmars-d
On Saturday, 2 April 2016 at 03:58:27 UTC, Daniel Murphy wrote: On 2/04/2016 7:28 AM, Vladimir Panteleev wrote: 4. We should use the autotester's auto-merge feature anyway. Can we disable both and force everyone to use the autotester? Not an answer to your question, but after accidentally

Re: D goes business! Bindings for SAP NetWeaver RFC SDK

2016-04-02 Thread Lars Johansson via Digitalmars-d-announce
On Saturday, 1 August 2015 at 22:09:16 UTC, Kai Nacke wrote: On Thursday, 2 July 2015 at 10:40:08 UTC, Kai Nacke wrote: Hi all! My latest project is D bindings for the SAP NetWeaver RFC SDK. The first code is available at https://github.com/redstar/sapnwrfc-d. It is currently only a port of

Re: Direntries seems to on other drives. (windows)

2016-04-02 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 1 April 2016 at 02:05:23 UTC, Taylor Hillegeist wrote: Even though i just checked for a valid path. [...] if(!args[1].buildNormalizedPath.isValidPath){writeln("Path is invalid! "); return;} From https://dlang.org/library/std/path/is_valid_path.html : It does *not* check

Re: Any usable SIMD implementation?

2016-04-02 Thread Martin Nowak via Digitalmars-d
On Saturday, 2 April 2016 at 06:13:24 UTC, Iain Buclaw wrote: I would just let the compiler optimize / vectorize the operation, but then again that it is probably just me who thinks these things. It's intended to replace the array ops in druntime, relying on vecorizers won't suffice, e.g.

[Issue 15859] opApply resolution on attributes

2016-04-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15859 --- Comment #1 from qs.il.paperi...@gmail.com --- (In reply to qs.il.paperinik from comment #0) > struct X > { > int opApply(int delegate(string) dg) > { > return dg("impure"); > } > > int opApply(int delegate(string) pure

Re: Any usable SIMD implementation?

2016-04-02 Thread Iain Buclaw via Digitalmars-d
On 2 Apr 2016 12:40 am, "Martin Nowak via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: > > On 03/31/2016 10:55 AM, ZombineDev wrote: > > [2]: https://github.com/D-Programming-Language/phobos/pull/2862 > > Well apparently stores w/ dmd's weird core.simd interface don't work, or > I can't

Re: "Squash and merge" on GitHub

2016-04-02 Thread Vladimir Panteleev via Digitalmars-d
On Saturday, 2 April 2016 at 05:18:47 UTC, Andrei Alexandrescu wrote: On 4/2/16 12:36 AM, Jack Stouffer wrote: On Saturday, 2 April 2016 at 03:58:27 UTC, Daniel Murphy wrote: On 2/04/2016 7:28 AM, Vladimir Panteleev wrote: 4. We should use the autotester's auto-merge feature anyway. Can