[Issue 12210] dlang.org home page example - Run button does not work
https://issues.dlang.org/show_bug.cgi?id=12210 --- Comment #12 from Gerald Jansen--- The "Round floating point numbers" example is too fragile. It vomits incomprehensible messages (not a pretty sight for casual visitors!) for almost any input except for one or more floating point numbers separated by a single space. The default input line "2.4 plus 2.4 ..." causes the crash, for example. So does any extra leading, trailing or embedded white-space. (Interestingly, input "2.4 2.4e9" doesn't crash, but only rounds the first number.) --
Re: RFC in Comparison between Rust, D and Go
On Monday, 9 November 2015 at 21:01:29 UTC, Andrei Alexandrescu wrote: On 11/09/2015 09:13 AM, Nordlöw wrote: Yet another shallow language comparison that needs to be corrected: https://www.quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Matej-%C4%BDach?srid=itC4=1 My response: https://goo.gl/VTEYFk -- Andrei This is a very strong and honest summary of the situation IMHO, and the straight talking and pinpoint accuracy of the problems gives me extra hope for the future of D at the same time.
Re: Difference between input range and forward range
On Tuesday, 10 November 2015 at 14:28:15 UTC, Shachar Shemesh wrote: Am I missing something? The short answer is that input ranges need to be copyable to work with foreach, because of how foreach is defined for ranges. The long answer is... Input ranges _are_ copyable. It's just that their state isn't guaranteed to be copied (and if it is copied, then it probably should have been a forward range anyway). The semantics of what happens when copying any type of range are undefined, because it depends on how the range is implemented. For example, if you have auto copy = orig; copy.popFront(); and the type of orig and copy is a reference type, then popping off an element from copy popped off an element from orig, whereas if the range is a value type, then popping off an element from copy has no effect on orig. And if the range is a pseudo-reference type, then it'll probably do something like pop off an element from orig but not affect orig's front, but it could also be that it has no effect on orig (what exactly happens depends on how the range is implemented). Basically, if you copy a range, you can't do _anything_ with the original unless you assign it a value, because what happens when you call anything on the original depends on how its implemented and thus is undefined behavior in general. I talked about this problem in my dconf 2015 talk: http://dconf.org/2015/talks/davis.html Now, with regards to foreach specifically, foreach(e; range) { // do stuff } becomes for(auto __c = range; !__c.empty; __c.popFront()) { auto e = _c.front; // do stuff } Notice that the range is copied. So, yes, for a range to work with foreach, it's going to have to be copyable. @disabling the postblit constructor is just going to cause you trouble. But the key thing here is that this means that once you use a range in a foreach loop, you can't use it for anything else. In generic code, you have to consider it to be consumed, because the state of range you passed to foreach is now undefined, since what happens when copying the range is undefined. This is true even if you put a break out of the loop, because the range was copied, and you simply cannot rely on the state of the range you passed to foreach after that copy. Now, if you know the exact semantics of a particular range type, and the code you're writing is not generic, then you have more leeway, but in generic code, you have to be very careful to make sure that you don't use a range that has been copied unless it's been assigned a new value - and that includes not using a range after passing it to foreach. We're frequently lax with this due to the fact that most ranges are value types or pseudo-reference types that act like value types, so they're not only forward ranges, but they're implicitly saved by a copy, and so we frequently get away with using a range after it's been copied, but it doesn't work in the general case. - Jonathan M Davis
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #12 from ZombineDev--- (In reply to Martin Nowak from comment #11) > Overall I get the impression we should depart with an installer system where > I have to host binary plugins myself [¹] (so they don't get lost) and spend > over an hour to make the installer log something. > There has been some recent development with NSIS-3.0, but I wonder what .msi > installer tools are out there. > > [¹]: https://dlang.dawg.eu/downloads/others/nsisunz-dll-1_0.zip I would like to see an installer written in D, so one can change anything he want in a single sane language. Obviously this is not trivial to do I don't expect anyone to write an installer system from scratch, but after reading the DMD installer script I got the feeling that if it wasn't for the GUI, it would take fewer lines to achieve the same in D and the code would be more comprehensible. I feel sorry for the poor soul who had to write this: [1] > > On topic I updated > https://dlang.dawg.eu/downloads/dmd.2.069.0~fix15824/ > to write an install.log into your C:\D folder. Seems like the installer > always appends to the log. Can you please run that and send me the log? > > Maybe something in our updated VS/SDK detection is the cause for the hang. After a few seconds I got a ~7MB file log file. You are right to think that the issue is due to the updated VS/SDK detection. The contents of install.log are: Call: 2674 Jump: 2691 Jump: 2708 Check previous dmd installation Check dmd already installed DetectVSAndSDK Call: 2564 Read VisualStudio\*\Setup\VC detect KitsRoot* detect KitsRoot* detect KitsRoot* detect KitsRoot* detect KitsRoot* [... repeated infinately ...] Previously I had a VS installed on this computer and later I uninstalled it, and probably some of the SDKs were left there. Is it possible that this is confusing the installer? Anyway, looking at this change [1], it looks like there is an infinite loop. 95% of the time when I referesh the call stack it is in kernelbase.dll:RegOpenKeyEx. [1]: https://github.com/D-Programming-Language/installer/blob/master/windows/EnvVarUpdate.nsh [2]: https://github.com/D-Programming-Language/installer/commit/818056aa2242d4ffb36807623d193f58e860a8e2#diff-b7d237f81c7c9c97afe3ee2097c8b267R395 --
Re: Difference between input range and forward range
I agree with these considerations. When I define non-copyable range (with disabled this) lot of standard phobos functions fails to compile instead of using *save* method. So logical question is in which cases we should use plain old struct copy or and when we should use *save* on forward ranges. Also good question is should we have input ranges copyable (or for what types of ranges they can be copyable)? Good example is network socket as input range, because we can't save the state of socket stream and get consumed data again so as I thing copying of such range looks meaningless (in my opinion). If we want to pass it somewhere it's better pass it by reference. Also passing range somewhere to access it in two different places simultaneously is also bad idea. The current state looks like we have current approach with range postblit constructor and +save+, because we have it for structs and it works somehow (yet) for trivial cases. But we don't have clear intentions about how it should really work. Copying and passing ranges should also be specifyed as part of range protocol, because it's very common use case and shouldn't be ambigous. Also as far as range could be class object we must consider how should they behave? Is there some ideas and understanding of what I am talking about?
Re: AliasSeq + isExpression type specialization behavior
On Tuesday, 10 November 2015 at 13:47:23 UTC, Brian Schott wrote: On Tuesday, 10 November 2015 at 10:28:45 UTC, Marc Schütz wrote: This fails, too: static assert(is(AliasSeq!(char) : AliasSeq!(dchar))); Which makes sense IMO, because it can be thought of as an unnamed struct, cp. the following: struct A { char c; } struct B { dchar c; } static assert(is(A : B)); // fails, as expected You're talking about Tuple. I'm talking about AliasSeq. A Tuple is just a struct with an AliasSeq member. Or seen from a different POV, an AliasSeq can be interpreted as the "innards" of the struct. IMO it therefore makes sense to expect an AliasSeq to behave analogously to a struct. The only exception to that is that AliasSeq auto-expands, of course.
Re: Deprecation: module std.stream is deprecated
On Tuesday, 10 November 2015 at 11:57:03 UTC, Jonathan M Davis wrote: ... building blocks rather than kitchen sinks. And most range-based ... I still can't really see why byChunk and byLine are part of the File API? Especially byLine, I'll get byChunk go for now. I think what I am trying to say is that there doesn't need to be a byLine, if lineSplitter could work with some range that comes out of the File. The problem with your example using joiner is that: (a) it is external to the calling function, and therefore messy, since it will have to be used everywhere. // not ideal printFile(f.byChunk(1000).joiner()); (b) still can't use the range to split by lines afterwards, lineSplitter etc don't work. void printFile(Range)(Range i) { foreach (l; lineSplitter(i)) { writefln("%d\n", l); } } void main() { File f = File("/etc/passwd"); printFile(f.byChunk(1000).joiner()); // Not work, linesplitter needs slicing and length? }
Re: Rust's simple download script
On Tuesday, 10 November 2015 at 00:46:39 UTC, Adam D. Ruppe wrote: Not necessarily. At least a separate download gives you a chance to verify the download was completed too. Piping direct into shell could deliver an end-of-file in the middle of a file (e.g. in the case of a network error) which might change the results. From sandstorm.io I know the trick to wrap everything into a function and call it in the end. An EOF will result in a syntax error then.
Re: When a variable is passed into a function, is its name kept somewhere for the function to acceess
On Tuesday, 10 November 2015 at 14:22:49 UTC, Gary Willoughby wrote: On Tuesday, 10 November 2015 at 14:14:33 UTC, DlangLearner wrote: Please enlighten me if this can be done, thanks. If i understand you, you could use a templated function: import std.stdio; void foo(alias a)() { writefln("%s was passed in.", a.stringof); } void main(string[] args) { auto bar = "bar"; foo!(bar); } This is what I want. Thank you so much, this is a really elegant solution.
Re: AliasSeq + isExpression type specialization behavior
On Monday, 9 November 2015 at 22:41:50 UTC, Brian Schott wrote: Given the following code: ``` import std.meta; static assert(is(char : dchar)); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, char))); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, dchar))); ``` The third static assert fails. Should it, given that the first and second pass? `:` in `is` is for testing whether the left type is implicitly convertible to the right type. `char` is implicitly convertible to `dchar` by promoting it. But `AliasSeq`s are collections; they're only implicitly convertible to themselves.
[Issue 12210] dlang.org home page example - Run button does not work
https://issues.dlang.org/show_bug.cgi?id=12210 --- Comment #13 from Vladimir Panteleev--- (In reply to Gerald Jansen from comment #12) > The "Round floating point numbers" example is too fragile. See issue 15050 --
Re: Rust's simple download script
On 11/10/15 7:50 AM, Jacob Carlborg wrote: On 2015-11-10 00:07, Andrei Alexandrescu wrote: Rust has a nice way to download at https://www.rust-lang.org/downloads.html for Posix: $ curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- The method is simple and transparent. An optional --channel=beta or --channel=nightly parameter chooses between a stable release (default), beta, or nightly build. Should we do something similar? A bit long but this will install DVM [1] and the latest compiler: curl -L -o dvm https://github.com/jacob-carlborg/dvm/releases/download/v0.4.4/dvm-0.4.4-osx && chmod +x dvm && ./dvm install dvm && source ~/.dvm/scripts/dvm && dvm install -l And on Windows (with Power Shell) : powershell -Command "Invoke-WebRequest https://github.com/jacob-carlborg/dvm/releases/download/v0.4.4/dvm-0.4.4-win.exe -OutFile dvm.exe" && dvm install dvm && dvm install -l Links to other platforms are available here [1]. [1] https://github.com/jacob-carlborg/dvm I've been using dvm, and do like it a lot. But I couple issues: 1. Every time I type dvm use, my path adds another directory. Couldn't you just replace the existing dvm path? 2. Every incorrect command given to dvm results in a stack trace. Otherwise, I thoroughly enjoy being able to switch/install compiler versions on a whim. -Steve
Re: Feature for paranoids
On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov wrote: Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor. Since assert(false) is special (cf. http://p0nce.github.io/d-idioms/#assert%28false%29-is-special) you can use the following construct to have always-on assertions: if (!cond) assert(false); instead of: assert(cond); But -release will still remove your in/out/invariant blocks.
Re: Rust's simple download script
On Tuesday, 10 November 2015 at 14:53:54 UTC, qznc wrote: From sandstorm.io I know the trick to wrap everything into a function and call it in the end. An EOF will result in a syntax error then. yeah, I guess that combined with https (assuming the user hasn't disabled the annoying ssl checks because they rarely work. seriously, how broken are curl and openssl's install systems for trusted certs? but i digress) But I guess them aren't really too bad, no worse than blindly copy/pasting at least.
Re: Rust's simple download script
On Tuesday, 10 November 2015 at 13:39:02 UTC, Márcio Martins wrote: Well, you already use D so obviously it works good enough for you. However, there might be a million people out there that would love D, but they don't even give it chance because they don't have the skill or the patience to find out how easy/hard it is install it. Making this extremely obvious and easy can only help. Yeah, this is exactly what happened to a friend of mine. The install instructions as we have them now are complete garbage. They either tell you nothing or actively mislead you with idiocy like copying files all around the system.
Re: Feature for paranoids
I wouldn't recommend release mode to paranoids. I personally use `debug invariant` and `debug assert` for purely debugging code.
Atila's article on Reddit: "Rust impressions from a C++/D programmer, part 1"
https://www.reddit.com/r/programming/comments/3s9cfe/rust_impressions_from_a_cd_programmer_part_1/ Ali
Re: Difference between input range and forward range
On Tuesday, 10 November 2015 at 14:28:15 UTC, Shachar Shemesh wrote: It seems that "foreach" requires that the range be copyable, in direct contradiction to the fact that Range is not a forward range. To add to what I said, whether a range is "copyable" has nothing to do with whether it is a forward range or not. What's supposed to be guaranteed with any and all ranges is that if you copy it, it has the exact same state as the original had - but _not_ that that state is separate from the original. So, if you have auto copy = orig; then you can pop elements off of copy like you would have popped them off of orig, but you must on longer pop elements off of orig. _copy_ is now the range. This is critical when you consider that most ranges will be copied when they're passed to a function. If they weren't copyable, they'd be almost useless. If you couple that with the extremely amorphous definition of "save" for forward ranges, there seems to be quite a confusion between the two. There is nothing amorphous about the definition of save. save duplicates a range such that you have two ranges of the same type which are independent of one another and which contain exactly the same elements. save provides a way to get a copy of the range's state regardless of whether it's value type, reference type, or pseudo-reference type. Consider, for instance, a range which is implemented as a class. It's a full-on reference type, and copying it around will never result in its state being copied. Without save, there would be no way to duplicate it. And save provides the _only_ generic means of duplicating a range. It's a bug any time that generic code depends on the state of a range being duplicated when it's copied. Unfortunately, because most ranges _do_ duplicate their state when they're copied, there's plenty of code out there which is buggy and relies on ranges being duplicated when they're copied. That's why it's so critical to test algorithms with a variety of range types. - Jonathan M Davis
[Issue 12210] dlang.org home page example - Run button does not work
https://issues.dlang.org/show_bug.cgi?id=12210 --- Comment #14 from Gerald Jansen--- (In reply to Vladimir Panteleev from comment #13) > (In reply to Gerald Jansen from comment #12) > > The "Round floating point numbers" example is too fragile. > > See issue 15050 I think this is a different issue as it also happens with filled Input but empty Args. Probably the regular expression is not adequate. --
[Issue 15051] Code that runs fine on dpaste.dzfl.pl refuses to run on dlang.org
https://issues.dlang.org/show_bug.cgi?id=15051 --- Comment #3 from Gerald Jansen--- (In reply to Gerald Jansen from comment #2) > But ... floating-point example on dlang.org still crashes. Please see Issue 12210#c12. --
Re: Rust's simple download script
On Monday, 9 November 2015 at 23:15:56 UTC, Dicebot wrote: - teaches people `curl X | sh` is fine and normal and not security abomination There is even a tumblr for that :) http://curlpipesh.tumblr.com/
Re: OS X libphobos2.so
On Monday, 9 November 2015 at 21:02:35 UTC, Jacob Carlborg wrote: On 2015-11-09 18:30, bitwise wrote: The AA is not needed. The offset of the TLS var is known at compile time. I was thinking instead of iterating over all loaded images. Something that could be done without modifying the compiler. If you look at sections_elf_shared.d you can see the signature of __tls_get_addr, and that it takes a pointer to the struct tls_index or something. *if* I understand correctly, one of the two vars in that struct is the index of the image, and the other is the offset into the imag's tls section. Not sure where/hoe that struct is outputted though. So you would have to figure out how to get the backend to do the same thing for OSX. I think the image index may have to be assigned at load time, but I'm not sure. If we're going to modify the backend it's better to match the native implementation. Why? I looked a bit at the implementation. For each TLS variable it outputs two symbols (at least if the variable is initialized). One with the same name as the variable, and one with the variable name plus a prefix, "$tlv$init". The symbol with the prefix contains the actual value which the variable is initialized in the source code with. The other symbol is a struct looking something like this: struct TLVDescriptor { void* function (TLVDescriptor*) thunk; size_t key; size_t offset; } The dynamic loader will, when an image is loaded, set "thunk" to a function implemented in the dynamic loader. "key" is set to a key created by "pthread_key_create". It then maps the key to the currently loading image. I think the compiler access the variable as if it were a global variable of type "TLVDescriptor". Then calls the thunk passing in the variable itself. So the following code: int a = 3; void foo() { auto b = a; } Would be lowered to: TLVDescriptor _a; int _a$tlv$init = 3; void foo() { TLVDescriptor tmp = _a; int b = cast(int) tmp.thunk(); } When the compiler stores the symbol in the image it would only need to set the offset since the dynamic loader sets the other two fields. Although I'm not sure how the "_a$tlv$init" symbol is used. If the dynamic loader completely handles that or if the compiler need to do something with that. Our current approach is already very similar - the one for linux/bsd, even more so than OSX. The data layout and exact specifics differ slightly, both the approach you're describing sounds basically the same as what we're already doing. We allocate the TLS block and pthread key for an entire image in one shot, instead of one var at a time, which is a difference, if I understand correctly...but aside from that, I think the effect is the same. On a slightly different note, I'm looking at our implementation right now... and a couple of things seem wrong with it. First of all, it allocates the TLS block for each thread that accesses a TLS var: https://github.com/D-Programming-Language/druntime/blob/fb127f747edb211b06b35a5a5e548f03e9b750e3/src/rt/sections_osx.d#L156 But where does it ever free it!? Does this mean it causes leaks when you create threads and access TLS vars from them? It seems so. Also, the memory is allocated using calloc, and the block is never added to the GC..doesn't this mean that the GC won't scan there, and could potentially free objects that are stored there? Bit
Re: Scientific computing in D
On Monday, 9 November 2015 at 19:31:14 UTC, Márcio Martins wrote: I have been running some MCMC simulations in Python and it's hard to cope with how unbelievably slow it is. Takes me almost a minute to run a few hundred thousand samples on my laptop whereas I can run the same simulation with a million samples in under 100ms, on my phone with JavaScript on a browser. Then, you spend a minute waiting for the simulation to finish, to find out you had an error in your report code that would have been easily caught with static typing. So annoying... No matter how interested I am in Bayesian statistics, I would think that an MCMC library is relatively lower in importance than a number of other libraries. I've written some Gibbs samplers in Matlab and Python. They are quite slow in those languages, but I didn't notice that the Python code was more than 2X or so slower than the Matlab code, and I believe that was almost entirely due to Matlab using Intel MKL and Numpy using a slightly less efficient implementation. While I learned a lot about MCMC by writing my own Gibbs samplers, I don't write them much anymore. I make more use of MC Stan, which can be called from Python with PyStan (maybe easier if you're on Linux than Windows, I tend to use rstan more which works easily with Windows). PyMC is another option that I've heard good things about, but I haven't tried it. I think the simplest way forward would be something like wrappers to functionality in other languages. With PyD, it shouldn't be inconceivable to have a wrapper to PyMC. Alternately, MC Stan is written in C++ and has interfaces to a number of languages. Being able to call Stan from D would be cool, especially since I don't even think there's a C++ interface yet (you have to use the command line or R or whatever). I have essentially no idea how to do that. Is anyone doing similar stuff with D? Unfortunately, I couldn't find any plotting libraries nor MATLAB-like numerical/stats libs in dub. My attitude is the more the better. This seems like another area where D could easily pick up momentum with RDMD and perhaps an integration with Jupyter which is becoming very very popular. That would be interesting, but I'm not sure how high a priority it is.
Re: Difference between input range and forward range
On 11/10/15 1:38 PM, Jonathan M Davis wrote: On Tuesday, 10 November 2015 at 17:16:41 UTC, Steven Schveighoffer wrote: I've never made it a secret that I dislike the 'save' requirement. In my experience, the only time you ever implement 'save' is to do the same thing as copying the range via =. To the point where people simply don't use the .save member, and their code always works, so what is the point? It may as well have been an enum isCopyable. Well, it's not that hard to come up with a range that has to implement save, because copying it doesn't save it. The obvious example is if it's implemented as a class. IMO, that shouldn't be a forward range. But in any case, the correct mechanism is: forward range -> a = b works and makes a copy of the iteration. non-forward range -> a = b fails, you'd have to use a = b.getRef or something like that -or- a = b is a moving operation (a is no longer usable) Classes wouldn't work with this because you can't overload assignment, but the whole range hierarchy system cannot be changed at this point anyway. Moving on... -Steve
Re: OS X libphobos2.so
On 2015-11-10 18:55, bitwise wrote: Why? Better compatibility, better performance. Why not? -- /Jacob Carlborg
Re: Difference between input range and forward range
On Tue, Nov 10, 2015 at 06:38:22PM +, Jonathan M Davis via Digitalmars-d wrote: > On Tuesday, 10 November 2015 at 17:16:41 UTC, Steven Schveighoffer wrote: > >I've never made it a secret that I dislike the 'save' requirement. In > >my experience, the only time you ever implement 'save' is to do the > >same thing as copying the range via =. To the point where people > >simply don't use the .save member, and their code always works, so > >what is the point? It may as well have been an enum isCopyable. > > Well, it's not that hard to come up with a range that has to implement > save, because copying it doesn't save it. The obvious example is if > it's implemented as a class. Another would be std.range.refRange which > exists specifically to turn a non-reference type range into a > reference type range. And really, any range that's an input range but > not a forward range is in that boat, because if copying it duplicated > it, then it could be a forward range. > > I really don't see any way around having something like save without > artificially restricting ranges to types which are implicitly saved > when copied (which would pretty much mean getting rid of pure input > ranges), but even if there were clearly a better way, that's a pretty > big change at this stage. [...] There are a few ranges in Phobos that needs to do non-trivial things in .save, that otherwise would not work properly. IIRC groupBy is one of them. I'm pretty sure there are one or two others. I've also needed to do this in my own code. All it takes is for one range to need non-trivial implementation in .save, and all the other wrapper ranges will need to do the same, in order to be semantically correct (e.g., if they wrap around a range in .r, then the copy returned by .save must have r = this.r.save, otherwise the returned range will have side-effects on the original range). T -- Meat: euphemism for dead animal. -- Flora
Re: Rust's simple download script
On 11/10/15 1:52 PM, Jacob Carlborg wrote: On 2015-11-10 17:56, Steven Schveighoffer wrote: I've been using dvm, and do like it a lot. But I couple issues: 1. Every time I type dvm use, my path adds another directory. Couldn't you just replace the existing dvm path? I guess. It was just easier this way. 2. Every incorrect command given to dvm results in a stack trace. Same thing here, laziness. It's best to report issues to github. Pull requests wouldn't hurt either ;) will do the first, and the second if I have time ;) Though I don't know if I could go back to using tango. Perhaps for a minor bugfix such as this... -Steve
Re: Difference between input range and forward range
On 11/10/15 9:28 AM, Shachar Shemesh wrote: Please consider the following program: The problem is that you defined a forward range without implementing all the primitives :) That is, you can easily make a copy of the range so it iterates from the current spot (the quintessential feature of forward ranges). You actually have to do *extra work* to make it a true input-but-not-forward-range. I've never made it a secret that I dislike the 'save' requirement. In my experience, the only time you ever implement 'save' is to do the same thing as copying the range via =. To the point where people simply don't use the .save member, and their code always works, so what is the point? It may as well have been an enum isCopyable. -Steve
Re: Rust's simple download script
On 10.11.2015 14:12, Márcio Martins wrote: Could then combine this with OS detection through user-agent on the website and show the user the most likely option and command-line suggestion. Relevant PR that detects the OS and adds a direct download link to the right file to the homepage: https://github.com/D-Programming-Language/dlang.org/pull/1139 Another thing I would do is not show LDC and GDC in the front page but have a "other options" sort of thing. People are afraid to fail and each decision is a potential failure that will scare new people off. The idea is that people that already use D know where to find the other compilers and more importantly what they are, but someone that does not use D might get intimidated by too many choices they don't have the knowledge to make confidently. Exactly.
Re: RFC in Comparison between Rust, D and Go
On Monday, 9 November 2015 at 21:01:29 UTC, Andrei Alexandrescu wrote: On 11/09/2015 09:13 AM, Nordlöw wrote: Yet another shallow language comparison that needs to be corrected: https://www.quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Matej-%C4%BDach?srid=itC4=1 My response: https://goo.gl/VTEYFk -- Andrei I agree with your assessments in general, though I'd like to point out that your criticism of the heavy-weight type system is a bit misguided. While it is indeed complex, its use cases are by no means limited to memory management, or even resource management in the narrow sense (i.e. when can a particular resource be released). It's also used for safe sharing of resources across threads without data races, for preventing iteration invalidation (which means more than just avoiding dangling pointers), as well as for many other ways to make the compiler check certain aspects of a program's correctness. These wide applications make the cost/benefit ratio considerably more favourable.
Re: I have this game engine...
Am Thu, 5 Nov 2015 14:42:52 +0100 schrieb Johannes Pfau: > > I see these archives are minimal, only the gdc binaries, but there > > is also a gcc binary... why is that? > > The filesize is very different than the ones bundled in devkitPro; > > is it intended that arm-none-eabi-gcc.exe (and friends) overwrite > > the ones in the devkitPro distro? > > That's the reason I still need to write a README ;-) > I'm not sure why the file size could be very different, I'll have a > look at that later. I've uploaded some new binaries. Changes: * Changed the download paths to to their final values: ftp://ftp.gdcproject.org/binaries/devkitARM/r44/ ftp://ftp.gdcproject.org/binaries/devkitPPC/r27/ * Integration into the homepage is finished and looks like this: http://www.pixhoster.info/f/2015-11/c2b4e71c57df7c718d6ab0f134d957b3.png I'm waiting for some feedback from the devkitpro maintainers as devkitPro/ARM/PPC are apparently trademarked. * The packages now contain README files * The packages now additionally contain builds of gdb 7.10 * The -gcc files have been removed for now * gdc -v now prints the DMD FE version and the used GDC commit * bugurl was changed to bugzilla.gdcproject.org I hope these were the last toolchain/build-setup related changes. Building toolchains with updated GDC versions is now trivial.
Re: Difference between input range and forward range
On Tuesday, 10 November 2015 at 16:33:02 UTC, Ur@nuz wrote: I agree with these considerations. When I define non-copyable range (with disabled this) lot of standard phobos functions fails to compile instead of using *save* method. So logical question is in which cases we should use plain old struct copy or and when we should use *save* on forward ranges. Also good question is should we have input ranges copyable (or for what types of ranges they can be copyable)? Good example is network socket as input range, because we can't save the state of socket stream and get consumed data again so as I thing copying of such range looks meaningless (in my opinion). If we want to pass it somewhere it's better pass it by reference. Passing by reference really doesn't work with ranges. Consider that most range-based functions are lazy and wrap the range that they're given in a new range. e.g. auto r = filter!pred(range); or auto r = map!func(range); The range has to be copied for that to work. And even if you could make it so that the result of functions like map or filter referred to the original range by reference, their return value would not be returned by ref, so if a function required that its argument by passed by ref, then you couldn't chain it. So, requiring that ranges be passed by ref would pretty much kill function chaining. Also passing range somewhere to access it in two different places simultaneously is also bad idea. The current state looks like we have current approach with range postblit constructor and +save+, because we have it for structs and it works somehow (yet) for trivial cases. But we don't have clear intentions about how it should really work. It's mostly clear, but it isn't necessarily straightforward to get it right. If you want to duplicate a range, then you _must_ use save. Copying a range by assigning it to another range is not actually copying it per the range API. You pretty much have to consider it a move and consider the original unusable after the copy. The problem is that for arrays and many of the common ranges, copying the range and calling save are semantically the same, so it's very easy to write code which assumes that behavior and then doesn't work with other types of changes. That's why it's critical to test range-based functions with a variety of ranges types - particularly reference types in addition to value types or dynamic arrays. Copying and passing ranges should also be specifyed as part of range protocol, because it's very common use case and shouldn't be ambigous. The semantics of copying a range depend heavily on how a range is implemented and cannot be defined in the general case: auto copy = orig; Dynamic arrays and classes will function fundamentally differently, and with structs, there are a variety of different semantics that that copy could have. What it ultimately comes down to is that while the range API can require that the copy be in the exact same state that the original was in, it can't say anything about the state of the original after the copy. Well-behaved range-based code has to assume that once orig has been copied, it is unusable. If the code wants to actually get a duplicate of the range, then it will have to use save, and the semantics of that _are_ well-defined and do not depend on the type of the range. Also as far as range could be class object we must consider how should they behave? There's really nothing to consider here. It's known how they should behave. There's really only one way that they _can_ behave. One of the main reasons that save exists is because of classes. While copying a dynamic array or many struct types is equivalent to save, it _can't_ be equivalent with a class. When you consider that fact, the required behavior of ranges pretty much falls into place on its own. We may very well need to be far clearer about what those semantics are and how that affects best practices, but there really isn't much (if any) wiggle room in what the range API does and doesn't guarantee and how it should be used. The problem is whether it's _actually_ used that way. If a range-based function is tested with a variety of range types - dynamic arrays, value types, reference types, etc. then it becomes clear very quickly when calls to save are required and how the function must be written to work for all of those range types. But far too often, range-based functions are tested with dynamic arrays and a few struct range types that wrap dynamic arrays, and bugs with regards to reference type ranges are not found. So, there's almost certainly a lot of range-based code out there that works fantastically with dynamic arrays but would fail miserably with a number of other range types. For the most part, I think that it's pretty clear how ranges have to act and how they need to be used based on their API when you actually look at how the range API
Re: Rust's simple download script
On 2015-11-10 17:56, Steven Schveighoffer wrote: I've been using dvm, and do like it a lot. But I couple issues: 1. Every time I type dvm use, my path adds another directory. Couldn't you just replace the existing dvm path? I guess. It was just easier this way. 2. Every incorrect command given to dvm results in a stack trace. Same thing here, laziness. It's best to report issues to github. Pull requests wouldn't hurt either ;) Otherwise, I thoroughly enjoy being able to switch/install compiler versions on a whim. Cool, thanks :) -- /Jacob Carlborg
[Issue 12697] -inline ICE backend\el.c 802
https://issues.dlang.org/show_bug.cgi?id=12697 Steven Dwychanged: What|Removed |Added CC||yoplit...@gmail.com --- Comment #2 from Steven Dwy --- My own reduction, compiled with -release -inline -O -lib: void foo() { void delegate() test; bar(test); } auto bar(Delegate, Args...)(Delegate deleg, Args args) { if(deleg) return deleg(args); else { alias problematicAlias = void; return; } } Interestingly, it seems to be caused by the alias. --
Re: OS X libphobos2.so
On Tuesday, 10 November 2015 at 18:57:52 UTC, Jacob Carlborg wrote: On 2015-11-10 18:55, bitwise wrote: Why? Better compatibility, better performance. How so? Why not? If it ain't broke...don't fix it :) Bit
Re: "Programming in D" ebook is available for purchase
On 10/30/15 3:29 AM, Joakim wrote: But I don't see how bitcoin is similar to any of those, perhaps you have _some_ explanation? You don't have to keep the bitcoin, all those sites will buy your bitcoin with dollars anytime you want. It's just an open way to trade value- in your case, just another payment/donation method- I don't see the issue. If it required setting up a bunch of software, sure, but those websites make it easy to set up, as they run the client for you. Begging the question, why not trade your bitcoin for dollars and buy it using those? -Steve
Re: Rust's simple download script
On 2015-11-10 20:00, Steven Schveighoffer wrote: Though I don't know if I could go back to using tango. Perhaps for a minor bugfix such as this... You're free to use Phobos if you prefer. I've started to modernized the code in a few places when I fixed some bug. -- /Jacob Carlborg
Re: Difference between input range and forward range
On Tuesday, 10 November 2015 at 17:16:41 UTC, Steven Schveighoffer wrote: I've never made it a secret that I dislike the 'save' requirement. In my experience, the only time you ever implement 'save' is to do the same thing as copying the range via =. To the point where people simply don't use the .save member, and their code always works, so what is the point? It may as well have been an enum isCopyable. Well, it's not that hard to come up with a range that has to implement save, because copying it doesn't save it. The obvious example is if it's implemented as a class. Another would be std.range.refRange which exists specifically to turn a non-reference type range into a reference type range. And really, any range that's an input range but not a forward range is in that boat, because if copying it duplicated it, then it could be a forward range. I really don't see any way around having something like save without artificially restricting ranges to types which are implicitly saved when copied (which would pretty much mean getting rid of pure input ranges), but even if there were clearly a better way, that's a pretty big change at this stage. - Jonathan M Davis
Re: RFC in Comparison between Rust, D and Go
On Tuesday, 10 November 2015 at 17:32:15 UTC, Marc Schütz wrote: resource be released). It's also used for safe sharing of resources across threads without data races, for preventing iteration invalidation (which means more than just avoiding dangling pointers), as well as for many other ways to make the compiler check certain aspects of a program's correctness. I agree that there are many interesting aspects to these type systems. IIRC Pony-lang also guarantee deadlock-free execution. Go 1.6 is going to get a dedicated SSA optimizer and also a memory sanitizer like C/C++, which might bring Go closer to C. But C is really all about having full control over memory layout and execution, it interfaces with just about any conceivable language and compiles to an insane amount of hardware. None of these other languages have that focus. Rust, Go and D are more like high level languages primarily for PCs. Although Rust is perhaps closest to C by having a lightweight runtime.
[Issue 15313] std.conv.emplace cannot initialize const objects
https://issues.dlang.org/show_bug.cgi?id=15313 ZombineDevchanged: What|Removed |Added CC||petar.p.ki...@gmail.com --- Comment #1 from ZombineDev --- Andrei, I think you meant to write: const Node* n = emplace!(const Node)(buf, 42, null, 10); --
Re: Feature for paranoids
On Tuesday, 10 November 2015 at 20:37:00 UTC, Fyodor Ustinov wrote: assert(false) AKA assert(0) - is a part of this language that I think it is absolute evil. WBR, Fyodor. I would say it's a minor evil, that create problems by needing an explanation. At this point it has been discussed to death already.
Re: RFC in Comparison between Rust, D and Go
On Tuesday, 10 November 2015 at 21:11:43 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 10 November 2015 at 20:08:44 UTC, rsw0x wrote: All C/C++ sanitizers are available to D, FYI. You can use them from LDC and probably GDC. Yet another reason for abandoning dmd, you get massive benefits like this for free. The ones that are based on llvm bitcode, yes. But Go already had tools like these: https://talks.golang.org/2014/static-analysis.slide#8 So I assumed they were going for something new in Go 1.6, but maybe not. I dunno. The announcement is here: http://blog.golang.org/6years On my phone so I only took a quick look, but this looks like a tool to help Go's horrible "type" system more than anything.
Re: Feature for paranoids
On Tuesday, 10 November 2015 at 15:44:26 UTC, ponce wrote: Since assert(false) is special (cf. http://p0nce.github.io/d-idioms/#assert%28false%29-is-special) you can use the following construct to have always-on assert(false) AKA assert(0) - is a part of this language that I think it is absolute evil. WBR, Fyodor.
Re: Scientific computing in D
On Tuesday, 10 November 2015 at 10:18:14 UTC, Idan Arye wrote: That's what dmdinline does. From the examples, it seems like it doesn't. It seems like it's compiling D code on the fly, rather than loading pre-compiled libraries as R extensions. Okay, I see what you're saying. You are correct that the examples look like that. That's because it is common in the R community to write your C/C++ code inline. It becomes an interactive process, and works good for debugging. You can take the same D functions, insert them in a D file inside an R package, include a Makefile, and your D functions become part of that package. They'll be compiled when you install the package. That way you only compile once.
Re: RFC in Comparison between Rust, D and Go
On Tuesday, 10 November 2015 at 20:08:44 UTC, rsw0x wrote: All C/C++ sanitizers are available to D, FYI. You can use them from LDC and probably GDC. Yet another reason for abandoning dmd, you get massive benefits like this for free. The ones that are based on llvm bitcode, yes. But Go already had tools like these: https://talks.golang.org/2014/static-analysis.slide#8 So I assumed they were going for something new in Go 1.6, but maybe not. I dunno. The announcement is here: http://blog.golang.org/6years
Re: Feature for paranoids
On Tuesday, 10 November 2015 at 13:09:09 UTC, Fyodor Ustinov wrote: Hi! Is it possible when using the "-release" indicate that this one in/out/invariant/assert should not to be disabled? WBR, Fyodor. I don't quite get why you'd like to use -release if you are paranoid enough to be afraid of assert(0)'s little difference in behaviour. Could you give a realistic use case? At the very least seeing why it is important to you can only be beneficial to the community.
[Issue 15314] New: infinite loop during dmd-2.069.0.exe installation
https://issues.dlang.org/show_bug.cgi?id=15314 Issue ID: 15314 Summary: infinite loop during dmd-2.069.0.exe installation Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: installer Assignee: nob...@puremagic.com Reporter: restlessmon...@ya.ru Created attachment 1566 --> https://issues.dlang.org/attachment.cgi?id=1566=edit part of Process Monitor log When I run dmd-2.069.0.exe on windows 32 bit system the installation process gets stuck in a loop which looks like: query_registry=>create_folder=>fail=>repeat See attached dmd_installation_log_1.txt You can see that it queries some registry values and then tries to create these 2 folders: C:\Program Files\Microsoft SDKs\Windows\v8.1A\lib\winv6.3\um\x64 C:\Program Files\Microsoft SDKs\Windows\v8.0A\lib\winv6.3\um\x64 But I don't have this 'lib' ones: C:\Program Files\Microsoft SDKs\Windows\v8.{0,1}1A\lib Then when I create those directory trees, I get some further errors about querying some directories... The thing is that I don't have any sdk installed here, but those registry keys seem to be forgotten by the uninstaller or something, aswell as those empty directories... Furthermore when I delete the "HKLM\Software\Microsoft\Microsoft SDKs" registry tree installer keeps querying it's children unsuccessfuly (it also queries "HKLM\Software\Microsoft\Windows Kits\Installed Roots"), staying in the infinite loop again. --
Re: Feature for paranoids
On Tuesday, 10 November 2015 at 20:46:14 UTC, cym13 wrote: I don't quite get why you'd like to use -release if you are paranoid enough to be afraid of assert(0)'s little difference in behaviour. Could you give a realistic use case? At the very least seeing why it is important to you can only be beneficial to the community. It will be too much text on the too poor English. :) WBR, Fyodor.
Re: RFC in Comparison between Rust, D and Go
On Tuesday, 10 November 2015 at 19:25:32 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 10 November 2015 at 17:32:15 UTC, Marc Schütz wrote: [...] I agree that there are many interesting aspects to these type systems. IIRC Pony-lang also guarantee deadlock-free execution. Go 1.6 is going to get a dedicated SSA optimizer and also a memory sanitizer like C/C++, which might bring Go closer to C. But C is really all about having full control over memory layout and execution, it interfaces with just about any conceivable language and compiles to an insane amount of hardware. None of these other languages have that focus. Rust, Go and D are more like high level languages primarily for PCs. Although Rust is perhaps closest to C by having a lightweight runtime. All C/C++ sanitizers are available to D, FYI. You can use them from LDC and probably GDC. Yet another reason for abandoning dmd, you get massive benefits like this for free.
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 ZombineDevchanged: What|Removed |Added CC||restlessmon...@ya.ru --- Comment #13 from ZombineDev --- *** Issue 15314 has been marked as a duplicate of this issue. *** --
[Issue 13324] dynamically load libcurl at runtime
https://issues.dlang.org/show_bug.cgi?id=13324 Martin Nowakchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: opCmp with structs
On 07.11.2015 16:59, anonymous wrote: Wat. It even compiles with @safe. That's not good. Filed an issue: https://issues.dlang.org/show_bug.cgi?id=15315
[Issue 15315] New: can break immutable with std.algorithm.move
https://issues.dlang.org/show_bug.cgi?id=15315 Issue ID: 15315 Summary: can break immutable with std.algorithm.move Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: ag0ae...@gmail.com Shown by Mike Parker in D.learn: http://forum.dlang.org/post/dqjesecgvpislphpo...@forum.dlang.org static struct ku { immutable int id; ~this() @safe {} } void main() @safe { ku k1 = ku(1); scope(exit) assert(k1.id == 1); /* fails */ ku k2 = ku(2); scope(exit) assert(k2.id == 2); /* fails too, because there's a destructor */ import std.algorithm: move; move(k2, k1); } --
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #14 from github-bugzi...@puremagic.com --- Commit pushed to stable at https://github.com/D-Programming-Language/installer https://github.com/D-Programming-Language/installer/commit/92de353bec470a0b992819c05a93f9044adb9763 Merge pull request #161 from rainers/endless_sdkcheck fix Issue 15284 - dmd installer hangs when updating installed windows version --
Re: Rust's simple download script
On Tuesday, 10 November 2015 at 16:56:50 UTC, Steven Schveighoffer wrote: I've been using dvm, and do like it a lot. But I couple issues: 1. Every time I type dvm use, my path adds another directory. Couldn't you just replace the existing dvm path? 2. Every incorrect command given to dvm results in a stack trace. Otherwise, I thoroughly enjoy being able to switch/install compiler versions on a whim. -Steve I too use dvm all the time and I wonder, if we could integrate it with dub one day and extend it to cater for LDC and GDC as well. In fact, without dvm life would be a lot harder and I think it's high time it became part of an official D toolchain alongside dub.
Re: ACCU: Self Publishing a Technical Book / Ask an expert about D; November 11, 2015
Reminder: This is tomorrow. Ali On 11/01/2015 03:28 PM, Ali Çehreli wrote: I will be giving a talk at the Silicon Valley ACCU: http://www.meetup.com/SFBay-Association-of-C-C-Users/events/225125586/ (I did not write that title nor the synopsis, which may have been updated by the time you read this.) Although I am confident about the self publishing part, I am sure there will be D questions that I am not expert enough. So, please make an effort to show up and support me. :) Thank you, Ali
What will replace the default XML parser and when?
I'm developing the next version of my game engine, and I want to add an easily editable configuration method by XML, especially as it's very easy to extend.
[Issue 15313] std.conv.emplace cannot initialize const objects
https://issues.dlang.org/show_bug.cgi?id=15313 --- Comment #2 from Andrei Alexandrescu--- (In reply to ZombineDev from comment #1) > Andrei, I think you meant to write: > const Node* n = emplace!(const Node)(buf, 42, null, 10); Correct, thanks! By mistake I pasted the minimally changed code that does work. --
Re: Rust's simple download script
On Tuesday, 10 November 2015 at 22:30:48 UTC, Chris wrote: I too use dvm all the time and I wonder, if we could integrate it with dub one day and extend it to cater for LDC and GDC as well. In fact, without dvm life would be a lot harder and I think it's high time it became part of an official D toolchain alongside dub. We should bundle all the existing tools and maybe create a minimal GUI for it. We have dub, dvm, dscanner etc. If we bundle these apps, we can create a small but powerful toolchain.
Re: OS X libphobos2.so
On Tuesday, 10 November 2015 at 17:55:58 UTC, bitwise wrote: Also, the memory is allocated using calloc, and the block is never added to the GC..doesn't this mean that the GC won't scan there, and could potentially free objects that are stored there? It's been quite some time long time since I have looked at the details of DMD's TLS emulation (LDC does not need it), but for scanning the TLS area, you want to have a look at initTLSRanges(). — David
[Issue 15293] File().byLine().map!toUpper throws UnicodeException@src\rt\util\utf.d(290): invalid UTF-8 sequence on pure ASCII file
https://issues.dlang.org/show_bug.cgi?id=15293 ag0ae...@gmail.com changed: What|Removed |Added Keywords||pull Component|druntime|phobos Assignee|nob...@puremagic.com|ag0ae...@gmail.com --- Comment #6 from ag0ae...@gmail.com --- https://github.com/D-Programming-Language/phobos/pull/3802 --
Re: Rust's simple download script
On 11/10/2015 08:12 AM, Márcio Martins wrote: > On Monday, 9 November 2015 at 23:07:57 UTC, Andrei Alexandrescu wrote: >> Rust has a nice way to download at https://www.rust-lang.org/downloads.html >> for Posix: >> >> $ curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- >> >> The method is simple and transparent. An optional --channel=beta or >> --channel=nightly parameter chooses between a stable release (default), >> beta, or nightly build. >> >> Should we do something similar? >> >> >> Andrei > > I also think curl | sh is bad, but the idea to have a quick no-brain "just > works" installation is great. One good step would be providing packages for > all major distros and providing a wget | pkginstall command which effectively > does the same thing: wget DMD.deb && dpkg -i DMD.deb for Debian/Ubuntu > > For example, newbies to Ubuntu might not even know what dpkg is so they will > not know what to do with a .deb file since their world consists of apt-get > mostly. Many people also don't know what x86 or x86_AMD64 stand for so yet > another doubt in a potential downloaders mind. > > Could then combine this with OS detection through user-agent on the website > and show the user the most likely option and command-line suggestion. > > Another thing I would do is not show LDC and GDC in the front page but have a > "other options" sort of thing. People are afraid to fail and each decision is > a potential failure that will scare new people off. The idea is that people > that already use D know where to find the other compilers and more > importantly what they are, but someone that does not use D might get > intimidated by too many choices they don't have the knowledge to make > confidently. > > If in doubt, A/B test it. :) Debian-based systems have d-apt, though it's hosted on SourceForge, which is (IMO) rather sketchy as of late. It's quite easy to create something similar for RPM-based repositories - I set one up on my local server, if I get some blessing I can post it here or work with others to get it migrated to a more official D server. (Preferably soon, I'll lose access to my wonderful upload speeds in a few months). I actually don't even install the RPM directly anymore, I update the repository on my server then just run `sudo dnf update` like I would for any other update. This doesn't handle every distro and OS, but it can help if we get things more convenient to install. -- Matt Soucy http://msoucy.me/ signature.asc Description: OpenPGP digital signature
Re: RFC in Comparison between Rust, D and Go
On Monday, 9 November 2015 at 21:01:29 UTC, Andrei Alexandrescu wrote: On 11/09/2015 09:13 AM, Nordlöw wrote: Yet another shallow language comparison that needs to be corrected: https://www.quora.com/Which-language-has-the-brightest-future-in-replacement-of-C-between-D-Go-and-Rust-And-Why/answer/Matej-%C4%BDach?srid=itC4=1 My response: https://goo.gl/VTEYFk -- Andrei Your answer is now the top post on the programming subreddit https://www.reddit.com/r/programming/comments/3sa6lf/d_has_no_vision_go_is_out_of_its_depth_rust/
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #8 from ZombineDev--- I killed the hanging installer, downloaded DMD-2.0.68.0 and installed it successfully (it didn't detect any previous installation of DMD). Then I ran dmd-2.069.0.exe, it reported that there was an old version and I chose to uninstall it. The installer hang just after I clicked the Finish button on the uninstaller which had completed its work. --
Re: phobos: What type to use instead of File when doing I/O on streams?
On Monday, 9 November 2015 at 19:42:53 UTC, J.Frank wrote: - Can you flush() a range? - Can you use select() on a range? Maybe you should factor out a function that does pure data processing on arbitrary ranges and manage sources of the ranges - opening, flushing and closing files - in the caller code?
Re: Generate wxD with dmc/dmd
On Monday, 9 November 2015 at 18:03:11 UTC, Vincent R wrote: On Saturday, 7 November 2015 at 22:12:55 UTC, Vincent R wrote: Hi, I am trying to generate the wxWidgets wrapper wxD on Windows through msys/mingw64(or cygwin). So I have downloaded wxWidgets-2.8.12 and dmd c++/d compiler respectively dmc/dmd but I still have an error. Let's consider we are using cygwin: [...] Actually I found my problem you can ignore my previous message. What was it?
Re: AliasSeq + isExpression type specialization behavior
On Monday, 9 November 2015 at 22:41:50 UTC, Brian Schott wrote: Given the following code: ``` import std.meta; static assert(is(char : dchar)); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, char))); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, dchar))); ``` The third static assert fails. Should it, given that the first and second pass? This fails, too: static assert(is(AliasSeq!(char) : AliasSeq!(dchar))); Which makes sense IMO, because it can be thought of as an unnamed struct, cp. the following: struct A { char c; } struct B { dchar c; } static assert(is(A : B)); // fails, as expected
Re: Scientific computing in D
On Monday, 9 November 2015 at 19:31:14 UTC, Márcio Martins wrote: I have been running some MCMC simulations in Python and it's hard to cope with how unbelievably slow it is. Takes me almost a minute to run a few hundred thousand samples on my laptop whereas I can run the same simulation with a million samples in under 100ms, on my phone with JavaScript on a browser. Then, you spend a minute waiting for the simulation to finish, to find out you had an error in your report code that would have been easily caught with static typing. So annoying... Is anyone doing similar stuff with D? Unfortunately, I couldn't find any plotting libraries nor MATLAB-like numerical/stats libs in dub. This seems like another area where D could easily pick up momentum with RDMD and perhaps an integration with Jupyter which is becoming very very popular. To give D a try in this field is definitely a good idea. It will pay in the long run, I believe. Where D lacks libraries and the like, there's always the option to interface to C (and C++ to a certain extent).
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #6 from ZombineDev--- Created attachment 1564 --> https://issues.dlang.org/attachment.cgi?id=1564=edit Process Explorer information about the installer, while it was hanging --
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 ZombineDevchanged: What|Removed |Added CC||petar.p.ki...@gmail.com --- Comment #5 from ZombineDev --- I hit the same problem when upgrading from DMD-2.069.0-b2 to DMD-2.069.0 (final release). Windows 8.1 Enterprise x64. I have attached the call stack obtained (while the installer was hanging) with Process Explorer. --
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 ZombineDevchanged: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |--- --
Re: @property
On Monday, 9 November 2015 at 22:42:16 UTC, Fyodor Ustinov wrote: If this feature will be removed, it will be very lacking code, like: writeln = "Hello, world!"; :) WBR, Fyodor. The feature is not being removed. Only the @property attribute and compiler check is being removed.
Re: Please vote for the DConf logo
I prefer 3. It's simple, but effective. The graphic looks like an Olympic torch to me, which is good, indicating that D is a champion! :-) IMHO 2 needs the graphic to be more stylistic, otherwise it's good and simple. If it is improved, maybe it can be used later/elsewhere. But I don't get the message of 1. The graphic is too complicated, and the significance of its components is not self-evident. Appreciate the work people are putting into this, though. No offence to any artist intended... -- Shriramana Sharma, Penguin #395953
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #10 from ZombineDev--- The issue is more serious than I thought. I actually can't use dmd-2.069.0.exe at all, even though I have removed the previous installation of DMD. Now when I start the installer it just starts hanging after it starts (the setup wizard window is not shown at all). --
Re: Scientific computing in D
On Mon, 2015-11-09 at 19:31 +, Márcio Martins via Digitalmars-d wrote: > I have been running some MCMC simulations in Python and it's hard > to cope with how unbelievably slow it is. > Takes me almost a minute to run a few hundred thousand samples on > my laptop whereas I can run the same simulation with a million > samples in under 100ms, on my phone with JavaScript on a browser. Are you using NumPy with Python, or pure Python? In either case you will be better served by profiling you code to find out whoch is actually the performance bottleneck and then doing one of: 1. Use Numba to JIT the Python and achieve native code speed. 2. Replace the Python code with D code using either CFFI or PyD. 3. Replace the Python code with Chapel code using either CFFI or PyChapel. You could also use C++ or Rust via CFFI, but I have little experience using Rust with Python and am trying to avoid C++. > Then, you spend a minute waiting for the simulation to finish, to > find out you had an error in your report code that would have > been easily caught with static typing. So annoying... > > Is anyone doing similar stuff with D? Unfortunately, I couldn't > find any plotting libraries nor MATLAB-like numerical/stats libs > in dub. No need if you leave the coordination code in Python and then use Matplotlib, etc. Just put the computational expensive code into Chapel or D, leave the rest of your code in Python. > This seems like another area where D could easily pick up > momentum with RDMD and perhaps an integration with Jupyter which > is becoming very very popular. Jupyter (née IPython) is only popular in one workflow, creting papers for people to read and play with the executable code fragments. This is a big area but only one of many. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: Scientific computing in D
On Tuesday, 10 November 2015 at 01:53:25 UTC, bachmeier wrote: On Tuesday, 10 November 2015 at 00:01:19 UTC, Idan Arye wrote: Weird approach. Usually, when one wants to use an interpreted language as an host to a compiled language, the strategy is precompile the compiled language's code and load it as extensions in the interpreted code. That's what dmdinline does. From the examples, it seems like it doesn't. It seems like it's compiling D code on the fly, rather than loading pre-compiled libraries as R extensions.
String interpolation
Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s lamb.".format("little").writeln; "Mary had a %2$s %1$s lamb.".format("little", "white").writeln; } Is this a "proper" way of string interpolation in D? This looks a little clumsy. Are there any better approaches? Quick skimming through the docs didn't give anything.
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #7 from ZombineDev--- (In reply to Martin Nowak from comment #1) > Could anyone with this problem check what files are left in the previous > installation folder? When the installer was hanging the C:\D\dmd2 folder was already deleted. (I also have dub installation there under C:\D\dub which was unchanged. I don't think there's a problem with it, because I haven't had such issues with any of the previous releases.) --
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 --- Comment #9 from ZombineDev--- Created attachment 1565 --> https://issues.dlang.org/attachment.cgi?id=1565=edit dmd-2.069.0-fix15284 also hangs after uninstall process explorer info --
[Issue 15284] dmd installer hangs when updating installed windows version
https://issues.dlang.org/show_bug.cgi?id=15284 ZombineDevchanged: What|Removed |Added Severity|major |regression --
Re: std.experimental.allocator optlink error
On Tuesday, 10 November 2015 at 08:48:37 UTC, ref2401 wrote: On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? How can I do that? When you setup dmd 2.069, did you use the 7z or installer ? Installer always btw. Thanks for response. I started thinking nobody cares. I downloaded the `dmd.2.069.0.windows.7z` file and replaced `phobos.lib` with one from the 7z package. Still getting the error.
Re: String interpolation
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote: Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s lamb.".format("little").writeln; "Mary had a %2$s %1$s lamb.".format("little", "white").writeln; } Is this a "proper" way of string interpolation in D? This looks a little clumsy. Are there any better approaches? Quick skimming through the docs didn't give anything. Whats clumsy about it? If it's the style (excessive use of UFCS), I'd have to agree with you. Could easily have been written as: format("Mary had a %s lamb", "little"); which I personally think is more readable...
Re: String interpolation
On Tuesday, 10 November 2015 at 10:21:32 UTC, tired_eyes wrote: Hi, The only example of string interpolation I've found so far is on Rosetta Code: void main() { import std.stdio, std.string; "Mary had a %s lamb.".format("little").writeln; "Mary had a %2$s %1$s lamb.".format("little", "white").writeln; } Is this a "proper" way of string interpolation in D? This looks a little clumsy. Are there any better approaches? Quick skimming through the docs didn't give anything. std.string.format and std.format are the standard options. What are you missing?
Re: std.experimental.allocator optlink error
On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? How can I do that? When you setup dmd 2.069, did you use the 7z or installer ? Installer always btw. Thanks for response. I started thinking nobody cares.
Re: std.experimental.allocator optlink error
On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? When you setup dmd 2.069, did you use the 7z or installer ? i have the same issue. i used the installer. i only have one d installation...
Re: @property
It was intended for stricter properties. See http://dlang.org/changelog/2.069.0.html#property-switch-deprecated Last iteration on it was http://wiki.dlang.org/DIP23
[Issue 15281] std\experimental\allocator\package.d not included in build script
https://issues.dlang.org/show_bug.cgi?id=15281 Richard Cattermolechanged: What|Removed |Added CC||alphaglosi...@gmail.com --- Comment #1 from Richard Cattermole --- Verified, it is only missing from Windows make files. Not Posix. --
Re: @property
On Tuesday, November 10, 2015 09:53:42 Gary Willoughby via Digitalmars-d-learn wrote: > On Monday, 9 November 2015 at 22:42:16 UTC, Fyodor Ustinov wrote: > > If this feature will be removed, it will be very lacking code, > > like: > > > > writeln = "Hello, world!"; > > > > :) > > WBR, > > Fyodor. > > The feature is not being removed. Only the @property attribute > and compiler check is being removed. All that's being removed at this point is the -property switch which enforced that non-@property functions be called with parens (since once UFCS was introduced, everyone hated having to provide empty parens for function calls that already had parens for template arguments). It's still up for discussion what we're going to do in terms of enforcing that @property functions get called without parens or whether we're going to require @property for the setter syntax, though we almost have to make it so that if an @property function returns a callable (e.g. delegate) that the parens call that callable, otherwise you really can't have property functions that return callables. For now, @property is _mostly_ for documentation purposes (though it does affect a few things like typeof). There are multiple DIPs on the topic (e.g. http://wiki.dlang.org/DIP23 ), but until one is accepted, we don't know for sure what's going to happen with @property. - Jonathan M Davis
[Issue 15309] [dmd-internal] ScopeExp.semantic() should set its type always
https://issues.dlang.org/show_bug.cgi?id=15309 --- Comment #3 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0d7462ac9ddc37acf11b4a94a8863d3c01bb434e fix Issue 15309 - [dmd-internal] ScopeExp.semantic() should set its type always Also check `(type !is null)` at the top of `ScopeExp.semantic()` to avoid repeated semantic analysis. --
[Issue 15239] ICE (assertion failure) in ctfeInterpret() — opDispatch & inline asm
https://issues.dlang.org/show_bug.cgi?id=15239 Issue 15239 depends on issue 15309, which changed state. Issue 15309 Summary: [dmd-internal] ScopeExp.semantic() should set its type always https://issues.dlang.org/show_bug.cgi?id=15309 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: String interpolation
On Tuesday, 10 November 2015 at 11:29:32 UTC, TheFlyingFiddle wrote: On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote: On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote: Ruby: a = 1 b = 4 puts "The number #{a} is less than #{b}" PHP: $a = 1; $b = 4; echo "The number $a is less than $b"; D: ??? int a = 1, b = 4; writefln("The number %s is less than %s", a, b); You can't do it the ruby / perl / php way in D. It could be possible if we had AST macros in the language but as it stands now it's not possible to do that. the closest you could get is something like this: string s = aliasFormat!("The number $a is less than $b", a, b); or aliasWrite!("The number $a is less than $b", a, b); Not really recommended though as these would end up creating lots of template bloat.! You could perhaps do it with a mixin instead of AST macros: int a = 10; int b = 20; writeln(mixin(interp!"The number #{a} is less than #{b}")); One thing that would make this a lot more elegant would be the ability to instantiate mixins in templates. For example: template interp(X) { alias interp = mixin(interpGenCode!X); } writeln(interp!"The number #{a} is less than #{b}"); Quite pleasant syntax this way :) Not sure if it's feasible to do this on the language side.
Re: Rust's simple download script
On 2015-11-10 00:07, Andrei Alexandrescu wrote: Rust has a nice way to download at https://www.rust-lang.org/downloads.html for Posix: $ curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- The method is simple and transparent. An optional --channel=beta or --channel=nightly parameter chooses between a stable release (default), beta, or nightly build. Should we do something similar? A bit long but this will install DVM [1] and the latest compiler: curl -L -o dvm https://github.com/jacob-carlborg/dvm/releases/download/v0.4.4/dvm-0.4.4-osx && chmod +x dvm && ./dvm install dvm && source ~/.dvm/scripts/dvm && dvm install -l And on Windows (with Power Shell) : powershell -Command "Invoke-WebRequest https://github.com/jacob-carlborg/dvm/releases/download/v0.4.4/dvm-0.4.4-win.exe -OutFile dvm.exe" && dvm install dvm && dvm install -l Links to other platforms are available here [1]. [1] https://github.com/jacob-carlborg/dvm -- /Jacob Carlborg
Re: Andrei's Quora comments on Reddit: "D has no vision. Go is out of its depth. Rust skipped leg day."
On Wednesday, 11 November 2015 at 01:03:47 UTC, Ali Çehreli wrote: https://www.reddit.com/r/programming/comments/3sa6lf/d_has_no_vision_go_is_out_of_its_depth_rust/ Ali How can one man be so quotable?
Re: DIP 84: Static Inheritance
On Tuesday, 10 November 2015 at 10:45:16 UTC, Atila Neves wrote: [snip] Updated. Atila As long as we're talking about syntax features that help this emulate regular inheritance, would it be worth adding a feature like this: template MySuperType(T) { enum MySuperType = validate!T; } void doAThing(MySuperType T)(T val) { } That would effectively lower to: void doAThing(T)(T val) if(__traits(compiles, MySuperType!T)) { } with better error reporting? This would certainly make the code more readable, and would simplify the conditional dramatically if you had more than 1 or 2 template parameters.
Multiple range enumeration
Hi, If I have multiple ranges, say: auto a = [1, 2, 3]; auto b = ["a", "b", "c"]; auto c = ["x", "y", "z"]; I'd like a composition range that enumerate all combinations of these ranges, having the same effect as a nested foreach loop: foreach (i; a) { foreach (j; b) { foreach (k; c) { writlen(i, j, k); } } } Is there such a generic function in std lib?
Proof of concept/proposal: reference counted closures/delegates
I wrote a proof of concept that explores how we could support fully featured reference counted closures: https://gist.github.com/JakobOvrum/69e64d82bcfed4c114a5 The proof_of_concept code path is just to show that the `scope` trick works. The with_new_trait code path proposes a new trait __traits(upvalues, func) which takes an alias to a function and returns an alias sequence describing the function's upvalues: (T1, ptrdiff_t offset1, T2, ptrdiff_t offset2, ...) Where each pair is the type of the upvalue and the upvalue's offset in bytes from the context pointer, which can be negative. This trait allows the library code to properly postblit and destroy upvalues, as well as being a reliable way to get the required size of the closure. The benefit of this approach is that it should work as a drop-in replacement for delegates, whether they're nested/anonymous functions or member functions. One difference from delegates is that conversion between functions of different attributes has to be explicit (with the constructor and opAssign). It shares the downside with delegates that upvalues aren't packed together, so while the proposed trait *can* be used to make C++-style value-type closures, they would carry junk in between the upvalues. As for the example implementation, I have more ideas to improve it, particularly regarding attribute propagation and code bloat elimination, but I'd rather do that if the new trait is implemented. Any thoughts?
Re: DIP 84: Static Inheritance
On Monday, 2 November 2015 at 22:21:07 UTC, Walter Bright wrote: On 11/2/2015 5:58 AM, Atila Neves wrote: On Saturday, 31 October 2015 at 09:49:59 UTC, Walter Bright wrote: Yes. And I think it would have much wider applicability than just struct inheritance. True. Should I change the DIP? I think that's a good idea. Updated. Atila
Re: String interpolation
On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote: On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote: Ruby: a = 1 b = 4 puts "The number #{a} is less than #{b}" PHP: $a = 1; $b = 4; echo "The number $a is less than $b"; D: ??? int a = 1, b = 4; writefln("The number %s is less than %s", a, b); You can't do it the ruby / perl / php way in D. It could be possible if we had AST macros in the language but as it stands now it's not possible to do that. the closest you could get is something like this: string s = aliasFormat!("The number $a is less than $b", a, b); or aliasWrite!("The number $a is less than $b", a, b); Not really recommended though as these would end up creating lots of template bloat.
Re: std.experimental.allocator optlink error
On 11/11/15 12:05 AM, uiop wrote: On Tuesday, 10 November 2015 at 10:34:56 UTC, ref2401 wrote: On Tuesday, 10 November 2015 at 08:48:37 UTC, ref2401 wrote: On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? How can I do that? When you setup dmd 2.069, did you use the 7z or installer ? Installer always btw. Thanks for response. I started thinking nobody cares. I downloaded the `dmd.2.069.0.windows.7z` file and replaced `phobos.lib` with one from the 7z package. Still getting the error. Wow, that would be an incredible error in the distribution ! Waiting for more confirmation to open a bugzilla issue. Otherwise if you are really sure open a ticket yourself. One already exists. I've confirmed it in the build scripts. It only effects Windows.
Dhee - tiny app to learn/try out D
I wrote up a small PyQt app to help me do quick coding of snippets in D to help me learn how D works. https://github.com/jamadagni/dhee I wish there was (a working) QtD so I wouldn't need to use Python, but well... Looked into GtkD a bit, but somehow Gtk never clicked with me... P.S.: I only cross-posted as I thought this is relevant to both announce/learn. -- Shriramana Sharma, Penguin #395953