Re: Killing the comma operator

2016-05-20 Thread Lionello Lunesu via Digitalmars-d
On 13/5/2016 20:44, Nick Treleaven wrote: On Thursday, 12 May 2016 at 02:51:33 UTC, Lionello Lunesu wrote: I'm trying to think of a case where changing a single value into a tuple with 2 (or more) values would silently change the behavior, but I can't think of any. Seems to me it would always

Re: Dub selects wrong version

2016-05-20 Thread ag0aep6g via Digitalmars-d-learn
On 05/21/2016 07:15 AM, Bauss wrote: On Saturday, 21 May 2016 at 05:03:14 UTC, ag0aep6g wrote: On 05/21/2016 06:54 AM, Bauss wrote: When I then compile with dub build I get this error: Selected package diamond 0.1.0 does not match the dependency specification >=0.2.1 <0.3.0 in package

Re: Dub selects wrong version

2016-05-20 Thread Bauss via Digitalmars-d-learn
On Saturday, 21 May 2016 at 05:03:14 UTC, ag0aep6g wrote: On 05/21/2016 06:54 AM, Bauss wrote: When I then compile with dub build I get this error: Selected package diamond 0.1.0 does not match the dependency specification >=0.2.1 <0.3.0 in package diamondtest. Need to "dub upgrade"? Have

Re: Dub selects wrong version

2016-05-20 Thread ag0aep6g via Digitalmars-d-learn
On 05/21/2016 06:54 AM, Bauss wrote: When I then compile with dub build I get this error: Selected package diamond 0.1.0 does not match the dependency specification >=0.2.1 <0.3.0 in package diamondtest. Need to "dub upgrade"? Have you tried "dub upgrade"?

Dub selects wrong version

2016-05-20 Thread Bauss via Digitalmars-d-learn
It seems like dub selects the wrong version of my package. I have tried the following: - Reinstall dub - Delete all packages - Clear dubs cache - Release new versions in the github repository - Update the dub package on code.dlang.org multiple times and it says it has the lates The issue is

Re: DMD producing huge binaries

2016-05-20 Thread Bill Hicks via Digitalmars-d
On Saturday, 21 May 2016 at 02:16:30 UTC, Era Scarecrow wrote: Unless there's a way to seed it consistently so order doesn't matter, it won't work. Although a fast CRC32 on the source could then give you a seed to work with, I'd prefer a hash over PRNG. There is no seed; it's a

Re: Enum that can be 0 or null

2016-05-20 Thread Alex Parrill via Digitalmars-d-learn
On Saturday, 21 May 2016 at 02:04:23 UTC, Mike Parker wrote: On Saturday, 21 May 2016 at 01:09:42 UTC, Alex Parrill wrote: Looks like my best bet is to mark it as deprecated and point them to Vk(Type).init instead. I would prefer to do something like this: enum VK_NULL_HANDLE_0 = 0; enum

Re: Immutable objects and constructor ?

2016-05-20 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote: This is confusing and frustrating. In C++ we can write MyInfos { . . . // one is a constant pointer to a constant object of type Obj Obj const * const one; . . . } And in main() Info const * x1 = MyInfos.one; x1 i a modifiable

Re: Immutable objects and constructor ?

2016-05-20 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote: But I now met another error in my main(). I can't assign the immutable object to a mutable reference. Info x1 = MyInfos.one; Is it possible to define a mutable reference to an immutable instance ?  This is confusing and frustrating.

Re: Immutable objects and constructor ?

2016-05-20 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 May 2016 at 20:30:22 UTC, chmike wrote: I'm a bit surprized that the language doesn't support this. We have immutable strings that can be assigned to different variables. Why couldn't we do the same with objects ? Consider this: immutable(char)[] str; Here, the array

Re: DMD producing huge binaries

2016-05-20 Thread Era Scarecrow via Digitalmars-d
On Saturday, 21 May 2016 at 01:35:05 UTC, Bill Hicks wrote: On Friday, 20 May 2016 at 19:41:16 UTC, Walter Bright wrote: Hashing produces reproducible unique values. Random will not be reproducible and may not even be unique. Just a troll here, but Quasirandom numbers are reproducible and

Re: Enum that can be 0 or null

2016-05-20 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 21 May 2016 at 01:09:42 UTC, Alex Parrill wrote: Looks like my best bet is to mark it as deprecated and point them to Vk(Type).init instead. I would prefer to do something like this: enum VK_NULL_HANDLE_0 = 0; enum VK_NULL_HANDLE_PTR = null; Then document it clearly. Alias

Re: Enum that can be 0 or null

2016-05-20 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 May 2016 at 22:10:51 UTC, tsbockman wrote: Just use null for pointer types, and 0 for integers. D is not C; you aren't *supposed* to be able to just copy-paste any random C snippet into D and expect it to work without modification. If that's not a satisfactory answer, please

Re: DMD producing huge binaries

2016-05-20 Thread Observer via Digitalmars-d
On Saturday, 21 May 2016 at 01:29:18 UTC, Observer wrote: My recollection is that successively compiled binaries are rarely directly comparable, because of timestamps embedded by compilers. So I have to ask: are there standard tools to understand enough of the ELF binary format (or whatever,

Re: DMD producing huge binaries

2016-05-20 Thread Bill Hicks via Digitalmars-d
On Friday, 20 May 2016 at 19:41:16 UTC, Walter Bright wrote: On 5/20/2016 6:24 AM, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? Hashing produces reproducible unique values. Random will not be reproducible and may not even be

Re: DMD producing huge binaries

2016-05-20 Thread Observer via Digitalmars-d
On Friday, 20 May 2016 at 21:09:23 UTC, cym13 wrote: It would make binary comparison of libraries and executables difficult which troubles me as comparing hashes is a basics of binary distribution security : you can check that a precompiled binary is legit by recompiling it in the same

Re: Enum that can be 0 or null

2016-05-20 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 20 May 2016 at 22:10:51 UTC, tsbockman wrote: Why do you need to? Just use null for pointer types, and 0 for integers. D is not C; you aren't *supposed* to be able to just copy-paste any random C snippet into D and expect it to work without modification. If that's not a

Re: mutable keyword

2016-05-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 20, 2016 21:35:27 ciechowoj via Digitalmars-d-learn wrote: > On Friday, 20 May 2016 at 20:45:05 UTC, Jonathan M Davis wrote: > > If you want something that's ref-counted and works in pure > > code, const will _not_ work, because you can't legally alter > > the ref-count. > > What

Re: amoeba, a chess engine written in D

2016-05-20 Thread extrawurst via Digitalmars-d-announce
On Friday, 20 May 2016 at 23:16:01 UTC, Richard Delorme wrote: I am pleased to announce the release of a chess engine written in D: https://github.com/abulmo/amoeba I am not aware of any other chess engine written with the D language. The source can be compiled with dmd, ldc or gdc, but the

Re: Implement async/await using Fiber

2016-05-20 Thread Ali Çehreli via Digitalmars-d-learn
On 05/20/2016 12:56 PM, Yuxuan Shui wrote: > On Friday, 20 May 2016 at 06:40:42 UTC, Jacob Carlborg wrote: >> On 2016-05-20 04:14, Yuxuan Shui wrote: >> >>> Hmm... This could work. But I'm not satisfied with this solution. What >>> if I have multiple yield sites in the fiber, and each have

[Issue 16049] core.sys.windows structs have wrong sizes and aligns

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16049 --- Comment #2 from j...@red.email.ne.jp --- (In reply to jiki from comment #1) > done > https://github.com/dlang/druntime/pull/1576 Note that I deferred to commit a module MMSYSTEM because it gets many conflicts with/without my previous commit

amoeba, a chess engine written in D

2016-05-20 Thread Richard Delorme via Digitalmars-d-announce
I am pleased to announce the release of a chess engine written in D: https://github.com/abulmo/amoeba I am not aware of any other chess engine written with the D language. The source can be compiled with dmd, ldc or gdc, but the best performance are obtained with the latter (almost twice

Re: DMD producing huge binaries

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d
On 05/20/2016 06:01 PM, Georgi D wrote: In essence the problem that should be solved is the long names of types. Voldemort returns are by far the worst. Compression and hashing should handle the rest. -- Andrei

Re: DMD producing huge binaries

2016-05-20 Thread Johan Engelen via Digitalmars-d
On Friday, 20 May 2016 at 19:45:36 UTC, Walter Bright wrote: Hashing isn't algorithmically cheap, either. I also don't think compression should be a performance issue. I heard that some compression algorithms are as fast as the data comes in, so fast enough for our purpose. The reason I

Re: Always false float comparisons

2016-05-20 Thread Walter Bright via Digitalmars-d
On 5/20/2016 5:36 AM, Tobias M wrote: Still an authority, though. If we're going to use the fallacy of appeal to authority, may I present Kahan who concurrently designed the IEEE 754 spec and the x87.

Re: DMD producing huge binaries

2016-05-20 Thread Era Scarecrow via Digitalmars-d
On Friday, 20 May 2016 at 22:01:21 UTC, Georgi D wrote: This is a very interesting idea. I see one problem though: The real issue is not just the return type but also the types of the input parameters to a function. So even if the return type of a method is encoded as "auto" the moment the

Re: Enum that can be 0 or null

2016-05-20 Thread tsbockman via Digitalmars-d-learn
On Friday, 20 May 2016 at 13:39:50 UTC, Alex Parrill wrote: (How) can I make a constant that is either zero or null depending on how it is used? In the general case, I don't think this is possible in D currently. (It will become possible if the proposed "multiple alias this" ever gets

Re: DMD producing huge binaries

2016-05-20 Thread Georgi D via Digitalmars-d
On Friday, 20 May 2016 at 19:37:23 UTC, Andrei Alexandrescu wrote: On 5/20/16 2:34 PM, Georgi D wrote: 1) Exponential growth of symbol name with voldemort types. I like Steven's solution where the compiler lowers the struct outside of the method. Was talking to Walter on the phone and he

Re: DMD producing huge binaries

2016-05-20 Thread H. S. Teoh via Digitalmars-d
On Fri, May 20, 2016 at 02:08:02PM -0700, Walter Bright via Digitalmars-d wrote: [...] > 2. having the compiler produce different .o files on different runs > with the same inputs is pretty eyebrow raising, and makes it harder to > debug the compiler, and harder to have a test suite for the

Re: template instantiation

2016-05-20 Thread tsbockman via Digitalmars-d-learn
On Thursday, 19 May 2016 at 20:14:48 UTC, vit wrote: Is this a bug? Yes. I've filed a report: https://issues.dlang.org/show_bug.cgi?id=16050

[Issue 16050] New: Template type parameter "action at at a distance"

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16050 Issue ID: 16050 Summary: Template type parameter "action at at a distance" Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: normal

Re: mutable keyword

2016-05-20 Thread ciechowoj via Digitalmars-d-learn
On Friday, 20 May 2016 at 20:45:05 UTC, Jonathan M Davis wrote: If you want something that's ref-counted and works in pure code, const will _not_ work, because you can't legally alter the ref-count. What about something like this (ignoring multi-threading issues): struct RefCountPool {

Re: DMD producing huge binaries

2016-05-20 Thread Dicebot via Digitalmars-d
On Friday, 20 May 2016 at 21:09:23 UTC, cym13 wrote: It would make binary comparison of libraries and executables difficult which troubles me as comparing hashes is a basics of binary distribution security : you can check that a precompiled binary is legit by recompiling it in the same

Re: Immutable objects and constructor ?

2016-05-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 20, 2016 20:30:22 chmike via Digitalmars-d-learn wrote: > On Friday, 20 May 2016 at 17:35:01 UTC, Kagamin wrote: > > On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote: > >> But I now met another error in my main(). I can't assign the > >> immutable object to a mutable reference.

Re: DMD producing huge binaries

2016-05-20 Thread cym13 via Digitalmars-d
On Friday, 20 May 2016 at 20:49:20 UTC, Dicebot wrote: On Friday, 20 May 2016 at 19:41:16 UTC, Walter Bright wrote: On 5/20/2016 6:24 AM, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? Hashing produces reproducible unique

Re: DMD producing huge binaries

2016-05-20 Thread Walter Bright via Digitalmars-d
On 5/20/2016 1:49 PM, Dicebot wrote: The question is: is it actually good for them to be reproducible? 1. yes, because the same type can be generated from multiple compilation units (the linker removes the duplicates - if they're not duplicates, the linker won't remove them). 2. having the

Re: mutable keyword

2016-05-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 20, 2016 19:33:49 Johan Engelen via Digitalmars-d-learn wrote: > On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: > > No. D's const and immutable provide no backdoors. Rather, they > > provide strong guarantees. So, if a variable is const, then it > > cannot be

Re: DMD producing huge binaries

2016-05-20 Thread Dicebot via Digitalmars-d
On Friday, 20 May 2016 at 19:41:16 UTC, Walter Bright wrote: On 5/20/2016 6:24 AM, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? Hashing produces reproducible unique values. Random will not be reproducible and may not even be

Re: mutable keyword

2016-05-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 20, 2016 18:23:26 Jack Applegame via Digitalmars-d-learn wrote: > On Friday, 20 May 2016 at 17:28:55 UTC, Namespace wrote: > > But you can cheat: > You can just cast const away: > struct A { > int id = 0; > > this(int id) { > this.id = id; > } > > void change() const {

Re: mutable keyword

2016-05-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 20, 2016 18:41:04 ciechowoj via Digitalmars-d-learn wrote: > On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: > > On Thursday, May 19, 2016 20:44:54 ciechowoj via > > > > Digitalmars-d-learn wrote: > >> Is there D equivalent of C++'s mutable keyword? Like the one >

Re: Immutable objects and constructor ?

2016-05-20 Thread chmike via Digitalmars-d-learn
On Friday, 20 May 2016 at 17:35:01 UTC, Kagamin wrote: On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote: But I now met another error in my main(). I can't assign the immutable object to a mutable reference. Info x1 = MyInfos.one; Is it possible to define a mutable reference to an

Re: My ACCU 2016 keynote video available online

2016-05-20 Thread Jens Müller via Digitalmars-d-announce
On Friday, 20 May 2016 at 20:04:35 UTC, Andrei Alexandrescu wrote: On 5/20/16 2:13 PM, Jens Müller wrote: No it doesn't work because you need to break in the last case. Consider the case when the last element of a is equal to an element in b. Next iteration you overrun a. I'm not that

Re: DMD producing huge binaries

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d
On 05/20/2016 03:45 PM, Walter Bright wrote: On 5/20/2016 5:57 AM, ZombineDev wrote: Walter's PR slows down the compilation with 25-40% according to my tests. I expect that compilation would be faster if the whole process is skipped altogether. The compressor only kicks in if the string is

Re: My ACCU 2016 keynote video available online

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 5/20/16 2:13 PM, Jens Müller wrote: No it doesn't work because you need to break in the last case. Consider the case when the last element of a is equal to an element in b. Next iteration you overrun a. I'm not that Bright :o). So you'd need one more test, but you still save the other test

Re: Implement async/await using Fiber

2016-05-20 Thread Yuxuan Shui via Digitalmars-d-learn
On Friday, 20 May 2016 at 06:40:42 UTC, Jacob Carlborg wrote: On 2016-05-20 04:14, Yuxuan Shui wrote: Hmm... This could work. But I'm not satisfied with this solution. What if I have multiple yield sites in the fiber, and each have different return types? Maybe I should use a Variant? I

Re: DMD producing huge binaries

2016-05-20 Thread Walter Bright via Digitalmars-d
On 5/20/2016 5:57 AM, ZombineDev wrote: Walter's PR slows down the compilation with 25-40% according to my tests. I expect that compilation would be faster if the whole process is skipped altogether. The compressor only kicks in if the string is longer than 64 bytes. I set it pretty low in

Re: DMD producing huge binaries

2016-05-20 Thread Walter Bright via Digitalmars-d
On 5/20/2016 6:24 AM, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? Hashing produces reproducible unique values. Random will not be reproducible and may not even be unique.

Re: DMD producing huge binaries

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d
On 5/20/16 2:34 PM, Georgi D wrote: 1) Exponential growth of symbol name with voldemort types. I like Steven's solution where the compiler lowers the struct outside of the method. Was talking to Walter on the phone and he just had one of those great ideas: encode in the function mangle that

Re: mutable keyword

2016-05-20 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: No. D's const and immutable provide no backdoors. Rather, they provide strong guarantees. So, if a variable is const, then it cannot be mutated (even internally) except via a mutable reference to the same data. The "even

Re: My ACCU 2016 keynote video available online

2016-05-20 Thread Walter Bright via Digitalmars-d-announce
On 5/20/2016 6:47 AM, H. S. Teoh via Digitalmars-d-announce wrote: Not to mention inconsistency in what exactly is being tested for: if you want to check if something is an input range, do you use is(typeof(R.empty)), etc., or should you use __traits(compiles, R.init.empty), or is it

[Issue 14084] cartesianProduct length is not defined

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14084 --- Comment #1 from hst...@quickfur.ath.cx --- One issue with defining .length in cartesianProduct is that the length grows exponentially with the number of arguments, and it's unclear what .length should return if it overflows size_t. --

[OT] Re: pl0stuff an optimizing pl0 > c transcompiler

2016-05-20 Thread Johan Engelen via Digitalmars-d-announce
On Friday, 20 May 2016 at 18:04:55 UTC, Stefan Koch wrote: Update I have implemented D codegen. The CodeGenerator as well as the optimizer work at CTFE. Therefore you can transcompile code at compileTime at call PL/0 functions as there were naively implemented in D. This is pretty cool :D

Re: Discuss vulkan erupted, the other auto-generated vulkan binding

2016-05-20 Thread maik klein via Digitalmars-d
On Thursday, 19 May 2016 at 15:44:27 UTC, ParticlePeter wrote: On Wednesday, 18 May 2016 at 20:28:09 UTC, Manuel König wrote: [...] As far as I understand Mike it is still possible. Suppose you build an engine based on (d-)vulkan/erupted, lets call it Turtle-Engine, you would also specify

Re: mutable keyword

2016-05-20 Thread Namespace via Digitalmars-d-learn
On Friday, 20 May 2016 at 18:42:44 UTC, Ali Çehreli wrote: On 05/20/2016 10:28 AM, Namespace wrote: > On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: >> On Thursday, May 19, 2016 20:44:54 ciechowoj via Digitalmars-d-learn >> wrote: >>> Is there D equivalent of C++'s mutable

Re: mutable keyword

2016-05-20 Thread ciechowoj via Digitalmars-d-learn
On Friday, 20 May 2016 at 18:23:26 UTC, Jack Applegame wrote: On Friday, 20 May 2016 at 17:28:55 UTC, Namespace wrote: But you can cheat: You can just cast const away: struct A { int id = 0; this(int id) { this.id = id; } void

Re: mutable keyword

2016-05-20 Thread Ali Çehreli via Digitalmars-d-learn
On 05/20/2016 10:28 AM, Namespace wrote: > On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: >> On Thursday, May 19, 2016 20:44:54 ciechowoj via Digitalmars-d-learn >> wrote: >>> Is there D equivalent of C++'s mutable keyword? Like the one that >>> allows to modify a field of

Re: mutable keyword

2016-05-20 Thread ciechowoj via Digitalmars-d-learn
On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: On Thursday, May 19, 2016 20:44:54 ciechowoj via Digitalmars-d-learn wrote: Is there D equivalent of C++'s mutable keyword? Like the one that allows to modify a field of struct from constant method. Or some alternative solution?

Re: mutable keyword

2016-05-20 Thread ag0aep6g via Digitalmars-d-learn
On 05/20/2016 08:23 PM, Jack Applegame wrote: You can just cast const away: struct A { int id = 0; this(int id) { this.id = id; } void change() const { (cast() id)++; } } That's not a valid D program, though.

Re: DMD producing huge binaries

2016-05-20 Thread Georgi D via Digitalmars-d
On Friday, 20 May 2016 at 16:21:55 UTC, ZombineDev wrote: On Friday, 20 May 2016 at 13:16:32 UTC, Johan Engelen wrote: On Friday, 20 May 2016 at 12:57:40 UTC, ZombineDev wrote: As I said earlier, it would be best if can prevent the generation of long symbols in the first place, because that

Re: mutable keyword

2016-05-20 Thread Jack Applegame via Digitalmars-d-learn
On Friday, 20 May 2016 at 17:28:55 UTC, Namespace wrote: But you can cheat: You can just cast const away: struct A { int id = 0; this(int id) { this.id = id; } void change() const { (cast() id)++; } }

Re: My ACCU 2016 keynote video available online

2016-05-20 Thread Jens Müller via Digitalmars-d-announce
On Friday, 20 May 2016 at 14:14:18 UTC, Andrei Alexandrescu wrote: On 05/19/2016 06:50 PM, Jens Müller wrote: What if you stomped over an index in a that has as an equal index in b (it could be anywhere in b). Hmmm, you're right. So that doesn't work, or at least not efficiently (the fixup

Re: pl0stuff an optimizing pl0 > c transcompiler

2016-05-20 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 20 May 2016 at 18:04:55 UTC, Stefan Koch wrote: Therefore you can transcompile code at compileTime at call PL/0 functions as there were naively implemented in D. If you do want to call functions from D. You cannot use the optimizer. As it does _very_ aggressive inlineing and will

[Issue 15939] GC.collect causes deadlock in multi-threaded environment

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15939 Artem Tarasov changed: What|Removed |Added CC||lomerei...@gmail.com

Re: pl0stuff an optimizing pl0 > c transcompiler

2016-05-20 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 28 December 2015 at 16:41:30 UTC, Stefan Koch wrote: On Monday, 28 December 2015 at 10:45:59 UTC, Nick B wrote: what languages do you plan to support for input and output ? I just planned on PL/0 as input and C as output. It is a simple one-pass (okay 2 pass if you count the

Re: Possible bug in std.path?

2016-05-20 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 20 May 2016 at 15:18:39 UTC, Hugo wrote: On the other hand, regular console commands and many console applications for Windows work as expected, so there must be a way to deal with this properly It is pretty easy to handle, but must happen at a higher level than

Re: Immutable objects and constructor ?

2016-05-20 Thread Kagamin via Digitalmars-d-learn
On Friday, 20 May 2016 at 16:09:54 UTC, chmike wrote: But I now met another error in my main(). I can't assign the immutable object to a mutable reference. Info x1 = MyInfos.one; Is it possible to define a mutable reference to an immutable instance ?  Sort of possible with a library

Re: DMD producing huge binaries

2016-05-20 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 20 May 2016 at 17:11:52 UTC, Wyatt wrote: I've probably missed something, but it seems like line noise just because we feel we must. Line and file is not unique because the same template would generate different functions for different arguments. Template arguments are a part of

Re: mutable keyword

2016-05-20 Thread Namespace via Digitalmars-d-learn
On Thursday, 19 May 2016 at 23:21:14 UTC, Jonathan M Davis wrote: On Thursday, May 19, 2016 20:44:54 ciechowoj via Digitalmars-d-learn wrote: Is there D equivalent of C++'s mutable keyword? Like the one that allows to modify a field of struct from constant method. Or some alternative solution?

Re: Always false float comparisons

2016-05-20 Thread HorseWrangler via Digitalmars-d
On Friday, 20 May 2016 at 11:22:48 UTC, Timon Gehr wrote: On 20.05.2016 08:12, Walter Bright wrote: I'm curious if you know of any language that meets your requirements. (Java 1.0 did, but Sun was forced to abandon that.) x86_64 assembly language. Similar discussion for Rust:

Re: DMD producing huge binaries

2016-05-20 Thread Wyatt via Digitalmars-d
On Friday, 20 May 2016 at 13:24:42 UTC, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? Naïve question: is a (randomly-)?generated _anything_ required? I've probably missed something, but it seems like line noise just because

Re: Immutable objects and constructor ?

2016-05-20 Thread chmike via Digitalmars-d-learn
On Friday, 20 May 2016 at 15:43:28 UTC, Marc Schütz wrote: It looks like your don't actually need `Obj` to be a real nested class. Try declaring it as `static Obj : Info { }`. This should work if `Obj`'s methods don't need access to `MyInfo`'s non-static members. That worked great. Thank

Re: DMD producing huge binaries

2016-05-20 Thread ZombineDev via Digitalmars-d
On Friday, 20 May 2016 at 13:16:32 UTC, Johan Engelen wrote: On Friday, 20 May 2016 at 12:57:40 UTC, ZombineDev wrote: As I said earlier, it would be best if can prevent the generation of long symbols in the first place, because that would improve the compilation times significantly. From

Re: Immutable objects and constructor ?

2016-05-20 Thread chmike via Digitalmars-d-learn
I solved the problem by moving the class Obj definition out of the class MyInfo. I still don't understand why I had to do that. In C++ this would work without problem. I now have interface Info {. . .} class Obj : Info {. . .} class MyInfos { . . . static immutable Obj one = new

Re: DMD producing huge binaries

2016-05-20 Thread ZombineDev via Digitalmars-d
On Friday, 20 May 2016 at 15:39:18 UTC, Rene Zwanenburg wrote: On Friday, 20 May 2016 at 12:08:37 UTC, ZombineDev wrote: @Rene How do you expect the compiler to know the exact return type, only by looking at this signature: auto transmogrify(string str); A possible implementation might be

Re: Immutable objects and constructor ?

2016-05-20 Thread Marc Schütz via Digitalmars-d-learn
On Friday, 20 May 2016 at 15:07:53 UTC, chmike wrote: The error message is gone, but I now have another compilation error message I don't understand. This is what I have in fact interface Info { . . . } class MyInfos { . . . protected: class Obj : Info { . . . } public:

Re: DMD producing huge binaries

2016-05-20 Thread Rene Zwanenburg via Digitalmars-d
On Friday, 20 May 2016 at 12:08:37 UTC, ZombineDev wrote: @Rene How do you expect the compiler to know the exact return type, only by looking at this signature: auto transmogrify(string str); A possible implementation might be this: auto transmogrify(string str) { return

Re: DMD producing huge binaries

2016-05-20 Thread Marc Schütz via Digitalmars-d
On Friday, 20 May 2016 at 13:24:42 UTC, Andrei Alexandrescu wrote: I don't see a need for hashing something. Would a randomly-generated string suffice? That would break separate compilation, wouldn't it?

Re: Possible bug in std.path?

2016-05-20 Thread Hugo via Digitalmars-d
On Friday, 20 May 2016 at 03:40:23 UTC, Walter Bright wrote: On 5/19/2016 6:35 PM, Hugo wrote: I assumed the function would deal with the trailing backslash. And it can. It just never received a trailing backslash because that was removed by the Windows argument processing. Yes, I can see

Re: Immutable objects and constructor ?

2016-05-20 Thread chmike via Digitalmars-d-learn
The error message is gone, but I now have another compilation error message I don't understand. This is what I have in fact interface Info { . . . } class MyInfos { . . . protected: class Obj : Info { . . . } public: static immutable Obj one = new immutable Obj(...);

Re: Use Requests to send data to webpage - how?

2016-05-20 Thread TheDGuy via Digitalmars-d-learn
On Friday, 20 May 2016 at 09:21:33 UTC, Kagamin wrote: Does this work? Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/;, [parameter:data]); No :(

Re: D's Auto Decoding and You

2016-05-20 Thread Martin Nowak via Digitalmars-d-announce
On Tuesday, 17 May 2016 at 14:06:37 UTC, Jack Stouffer wrote: Related discussion https://trello.com/c/4XmFdcp6/163-rediscuss-redundant-utf-8-string-validation.

[Issue 14519] Get rid of unicode validation in string processing

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14519 --- Comment #38 from Martin Nowak --- (In reply to Vladimir Panteleev from comment #36) > Question, is there any overhead in actually verifying the validity of UTF-8 > streams, or is all overhead related to error handling (i.e.

Re: My ACCU 2016 keynote video available online

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 05/19/2016 06:50 PM, Jens Müller wrote: What if you stomped over an index in a that has as an equal index in b (it could be anywhere in b). Hmmm, you're right. So that doesn't work, or at least not efficiently (the fixup would entail a binary search in b). How about this idea: arrange

Immutable objects and constructor ?

2016-05-20 Thread chmike via Digitalmars-d-learn
I'm implementing the flyweight pattern. It means that I have a set of object instances representing all the possible values. This allows me to manipulate "values" by simply manipulating references to the instance. Testing "value" equality boils down to simply compare reference value. I hope

Re: DMD producing huge binaries

2016-05-20 Thread H. S. Teoh via Digitalmars-d
On Fri, May 20, 2016 at 09:24:42AM -0400, Andrei Alexandrescu via Digitalmars-d wrote: > On 05/20/2016 09:07 AM, Johan Engelen wrote: [...] > > One obstacle is the hasher itself: I am not going to implement one > > myself! In the LDC PR, I used LLVM's MD5 hasher and Phobos's MD5 > > hasher.

Enum that can be 0 or null

2016-05-20 Thread Alex Parrill via Digitalmars-d-learn
(How) can I make a constant that is either zero or null depending on how it is used? Vulkan has a VK_NULL_HANDLE constant which in C is defined to be zero. It is used as a null object for several types of objects. In D however, zero is not implicitly convertible to a null pointer, and vice

Re: DMD producing huge binaries

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d
On 05/20/2016 09:07 AM, Johan Engelen wrote: On Friday, 20 May 2016 at 12:30:10 UTC, Andrei Alexandrescu wrote: On 05/20/2016 08:21 AM, Johan Engelen wrote: https://github.com/ldc-developers/ldc/pull/1445: "Hashed symbols look like this:

Re: DMD producing huge binaries

2016-05-20 Thread Johan Engelen via Digitalmars-d
On Friday, 20 May 2016 at 12:57:40 UTC, ZombineDev wrote: As I said earlier, it would be best if can prevent the generation of long symbols in the first place, because that would improve the compilation times significantly. From what I've observed, generating the long symbol name itself is

Re: DMD producing huge binaries

2016-05-20 Thread Johan Engelen via Digitalmars-d
On Friday, 20 May 2016 at 12:30:10 UTC, Andrei Alexandrescu wrote: On 05/20/2016 08:21 AM, Johan Engelen wrote: https://github.com/ldc-developers/ldc/pull/1445: "Hashed symbols look like this: _D3one3two5three3L3433_46a82aac733d8a4b3588d7fa8937aad66Result3fooZ ddemangle gives:

[Issue 15831] IFTI voldemort type exploding bloat

2016-05-20 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15831 Rainer Schuetze changed: What|Removed |Added CC||r.sagita...@gmx.de

Re: DMD producing huge binaries

2016-05-20 Thread ZombineDev via Digitalmars-d
On Friday, 20 May 2016 at 12:21:58 UTC, Johan Engelen wrote: On Friday, 20 May 2016 at 10:54:18 UTC, Andrei Alexandrescu wrote: On 5/19/16 6:16 PM, Walter Bright wrote: On 5/19/2016 6:45 AM, Andrei Alexandrescu wrote: I very much advocate slapping a 64-long random string for all Voldermort

Re: Always false float comparisons

2016-05-20 Thread Tobias M via Digitalmars-d
On Friday, 20 May 2016 at 12:32:40 UTC, Tobias Müller wrote: Let me cite Prof. John L Gustafson Not "Prof." but "Dr.", sorry about that. Still an authority, though.

Re: Always false float comparisons

2016-05-20 Thread Johan Engelen via Digitalmars-d
On Thursday, 19 May 2016 at 18:22:48 UTC, Timon Gehr wrote: dmd -run kahanDemo.d 1000.00 1001.00 1000.00 dmd -m32 -O -run kahanDemo.d 1000.00 1000.00 1000.00 Better? Ignore if you think it's not

Re: Always false float comparisons

2016-05-20 Thread Tobias Müller via Digitalmars-d
On Friday, 20 May 2016 at 06:12:44 UTC, Walter Bright wrote: On 5/19/2016 1:26 PM, Timon Gehr wrote: Those two lines producing different results is unexpected, because you are explicitly saying that y is a double, and the first line also does implicit rounding (probably -- on all compilers and

Re: DMD producing huge binaries

2016-05-20 Thread Andrei Alexandrescu via Digitalmars-d
On 05/20/2016 08:21 AM, Johan Engelen wrote: On Friday, 20 May 2016 at 10:54:18 UTC, Andrei Alexandrescu wrote: On 5/19/16 6:16 PM, Walter Bright wrote: On 5/19/2016 6:45 AM, Andrei Alexandrescu wrote: I very much advocate slapping a 64-long random string for all Voldermort returns and

Re: DMD producing huge binaries

2016-05-20 Thread Johan Engelen via Digitalmars-d
On Friday, 20 May 2016 at 10:54:18 UTC, Andrei Alexandrescu wrote: On 5/19/16 6:16 PM, Walter Bright wrote: On 5/19/2016 6:45 AM, Andrei Alexandrescu wrote: I very much advocate slapping a 64-long random string for all Voldermort returns and calling it a day. I bet Liran's code will get a lot

Re: DMD producing huge binaries

2016-05-20 Thread ZombineDev via Digitalmars-d
On Friday, 20 May 2016 at 12:01:14 UTC, ZombineDev wrote: On Friday, 20 May 2016 at 11:40:12 UTC, Rene Zwanenburg wrote: On Friday, 20 May 2016 at 11:32:16 UTC, ZombineDev wrote: IMO, the best way forward is: + The compiler should lower voldemort types, according to the scheme that Steve

Re: DMD producing huge binaries

2016-05-20 Thread ZombineDev via Digitalmars-d
On Friday, 20 May 2016 at 11:40:12 UTC, Rene Zwanenburg wrote: On Friday, 20 May 2016 at 11:32:16 UTC, ZombineDev wrote: IMO, the best way forward is: + The compiler should lower voldemort types, according to the scheme that Steve suggested

Re: DMD producing huge binaries

2016-05-20 Thread Rene Zwanenburg via Digitalmars-d
On Friday, 20 May 2016 at 11:32:16 UTC, ZombineDev wrote: IMO, the best way forward is: + The compiler should lower voldemort types, according to the scheme that Steve suggested (http://forum.dlang.org/post/nhkmo7$ob5$1...@digitalmars.com) + After that, during symbol generation (mangling) if a

Re: Always false float comparisons

2016-05-20 Thread Joakim via Digitalmars-d
On Friday, 20 May 2016 at 11:02:45 UTC, Timon Gehr wrote: On 20.05.2016 11:14, Joakim wrote: On Thursday, 19 May 2016 at 18:22:48 UTC, Timon Gehr wrote: On 19.05.2016 08:04, Joakim wrote: On Wednesday, 18 May 2016 at 17:10:25 UTC, Timon Gehr wrote: It's not just slightly worse, it can cut the

  1   2   >