Re: Voting for std.experimental.allocator
Yes.
Re: Walter, Brian, and Daniel's DConf 2015 talks are up
On Friday, 19 June 2015 at 22:47:03 UTC, Brad Anderson wrote: Walter: https://www.youtube.com/watch?v=znjesAXEEqw Brian: https://www.youtube.com/watch?v=FmFyB9e7edw Daniel: https://www.youtube.com/watch?v=5daHGXSetXk I've only just started watching but the editing seems to be well done so thanks to UVU for that. David: https://www.youtube.com/watch?v=WzXe2kT9sEo Amaury: https://www.youtube.com/watch?v=ScHZsO1RzAI
Re: Naming things
On Saturday, 20 June 2015 at 09:27:16 UTC, Vladimir Panteleev wrote: Naming things There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Hello, There has been a lot of recent debate regarding the names of some new functions recently added to Phobos. ... I'd like to note my support for consistent/standardized naming (especially with regards to `withExtension`/`setExt`). As an end-user of D, it's very important to me that a precedent be set for naming prior to D releases - it means less time spent upfront perusing documentation, and less time spent trying to understand how a particular function works. When I'm viewing code in the wild, so to speak, time spent trying to understand byzantine names is time wasted. In this particular case, `withExtension` is objectively better than `setExt.` The `with` prefix indicates lazy operation - this is a much better cue as to the function's operation than the truncation of an already-existing name. Truncating the name will, without a doubt, lead to user confusion: these two functions have the same goal, but operate in fundamentally different ways, and the name should reflect this. The alphanumerical sorting argument has little validity, especially seeing as the See Also section serves the same purpose. I understand that the community's been beset with naming discussions for the longest of times - and yes, they can often be non-productive - but there are some cases in which it is very much worth the time choosing a better name. `setExt` is objectively confusing and uncommunicative of its actual functionality - and it can be fixed now, before it becomes a permanent wart. As a final note, naming conventions are very important for the end-user of a programming language. If one goes with a 'pick the first name that works' approach, the result is a very unproductive, contradictory language; an extreme example of this can be seen in PHP, where programmers often have to consult the documentation for *every* function to find the correct name for every function. We have the ability to prevent that from happening here.
Re: forum.dlang.org, version 2 (BETA)
On Thursday, 4 June 2015 at 15:04:05 UTC, Vladimir Panteleev wrote: http://beta.forum.dlang.org/ Many major and minor improvements. Some major ones: - dlang.org theme, fully responsive and mobile-friendly - keyboard navigation in all views - automatically saved post drafts - get notified of new posts and replies with subscriptions - full text search - by persistent request, a new view mode (vertical-split) - post to mailing lists - even faster, believe it or not. This update is the sum of 256 commits over 34 days of development. Can you make the breadcrumb links at the top of the forum larger? They're a little too small for easy navigation.
Re: Reset Range
On Saturday, 30 May 2015 at 08:36:02 UTC, tcak wrote: I have never interested in Range topic till now, but with Walter's presentation, I took a look at it today. Ali has a nice lesson page about it (http://ddili.org/ders/d.en/ranges.html). What I don't get is the mechanism to reset a range. I mean, you use a range with foreach, but then it is totally consumed. I cannot use it again. Because it will be empty. No special property function is defined for this. Maybe the reason I don't understand it is that it doesn't fit to my needs. You take a copy of the range prior to iteration with the 'save' method (which all forward ranges have: http://dlang.org/phobos/std_range_primitives.html#isForwardRange) if you need to reuse it.
Re: DConf 2015 talk quota
On Saturday, 7 March 2015 at 08:13:34 UTC, Daniel Murphy wrote: Philpax wrote in message news:zhxwmatecvtmormmm...@forum.dlang.org... The last bit of news I saw suggested that DConf 2015 hadn't met its talk quota in time; is this still the case, or have a suitable number of talks been sent in? I had an idea for a talk, but wasn't sure if it was interesting/unique enough. Andrei confirmed there were enough submissions. http://forum.dlang.org/post/md20ov$30d2$1...@digitalmars.com Awesome, looking forward to the talks this year :)
DConf 2015 talk quota
Hi everyone, The last bit of news I saw suggested that DConf 2015 hadn't met its talk quota in time; is this still the case, or have a suitable number of talks been sent in? I had an idea for a talk, but wasn't sure if it was interesting/unique enough. Cheers, Philpax
Re: Heady House Hunting with D
On Friday, 16 January 2015 at 18:44:47 UTC, Robert M. Münch wrote: On 2015-01-14 03:46:38 +, Philpax said: I recently wrote a blog post about how I used D/vibe.d to help find a new house. I haven't publicized it anywhere else yet, so I'm looking forward to what the D community has to say! You can check it out here: http://philpax.me/blog/heady-house-hunting-with-d Cool stuff! I saw this: With real data, this produced a list of ~40 houses with all relevant information included Well, my company is doing a mathematics based pricing analysis based on properties (an enhanced multi dimensional regression analysis approach). See: http://www.nlpp.ch So, if you want to see how the prices shouldbe and which criteria drives the costs, let me know. Houseprices would be a nice showcase I wanted to do for some time. I'd definitely like to see this. I wanted to try out something similar, but working with unsold houses meant that all the data was in flux (especially price). A more detailed analysis based upon already-sold houses would be quite interesting!
Re: Heady House Hunting with D
On Friday, 16 January 2015 at 20:20:56 UTC, Vladimir Panteleev wrote: On Wednesday, 14 January 2015 at 03:46:39 UTC, Philpax wrote: Hey everyone, I recently wrote a blog post about how I used D/vibe.d to help find a new house. I haven't publicized it anywhere else yet, so I'm looking forward to what the D community has to say! You can check it out here: http://philpax.me/blog/heady-house-hunting-with-d D made it easy to model the problem and quickly crunch through it; I'm pretty happy with how quickly I was able to get decent results. It's not the most idiomatic of code, but D's flexibility meant that I could concentrate on the concept instead of the implementation details. Heh, I wrote something similar (much much simpler) to find the best hotel for DConf 2013. The program extracted the hotel's geographical coordinates, and then queried the Google Maps API to find the one that had the shortest public transit time assuming we wanted to arrive at 8:30 AM. Since then, I started doing it for all important purchases - TV, AC unit, laptop... The laptop program used a score model like yours. The biggest issue is that it's hard to find accurate information on household hardware, especially since there are a myriad models for each tiny European market. Here's the hotel program (list.txt is a list of booking.com URLs): http://dump.thecybershadow.net/2ebca3f47b801aed0104585f60b9587e/scan.d By the way, does your blog have a RSS feed for D posts? Then I could add it to Planet D. Heh, good to know that other people have taken similarly clever approaches to decision making :) I don't have a D-specific RSS feed (my blog's fairly simple, since I haven't written many posts) but I have one for all posts: http://philpax.me/news.rss. In the future, I'll consider adding categories and category-specific RSS feeds.
Re: Heady House Hunting with D
On Sunday, 18 January 2015 at 13:06:06 UTC, Mengu wrote: On Saturday, 17 January 2015 at 21:41:15 UTC, Andrei Alexandrescu wrote: On 1/17/15 12:18 PM, Meta wrote: On Wednesday, 14 January 2015 at 03:46:39 UTC, Philpax wrote: Hey everyone, I recently wrote a blog post about how I used D/vibe.d to help find a new house. I haven't publicized it anywhere else yet, so I'm looking forward to what the D community has to say! You can check it out here: http://philpax.me/blog/heady-house-hunting-with-d D made it easy to model the problem and quickly crunch through it; I'm pretty happy with how quickly I was able to get decent results. It's not the most idiomatic of code, but D's flexibility meant that I could concentrate on the concept instead of the implementation details. Thanks, Philpax Any plans to post this to Reddit/Hackernews? http://www.reddit.com/r/programming/comments/2sf48d/heady_house_hunting_with_d_xposted_rd_language/ Andrei maybe we should just link the main websites when creating reddit links instead of the forum? I would've preferred that, as I wanted to screen it by the D community before having it linked to elsewhere. Not a huge deal, though.
Heady House Hunting with D
Hey everyone, I recently wrote a blog post about how I used D/vibe.d to help find a new house. I haven't publicized it anywhere else yet, so I'm looking forward to what the D community has to say! You can check it out here: http://philpax.me/blog/heady-house-hunting-with-d D made it easy to model the problem and quickly crunch through it; I'm pretty happy with how quickly I was able to get decent results. It's not the most idiomatic of code, but D's flexibility meant that I could concentrate on the concept instead of the implementation details. Thanks, Philpax
Re: @safe, pure and nothrow at the beginning of a module
On Friday, 15 August 2014 at 23:22:27 UTC, Vlad Levenfeld wrote: On Friday, 15 August 2014 at 16:54:54 UTC, Philippe Sigaud wrote: So I'm trying to use @safe, pure and nothrow. If I understand correctly Adam Ruppe's Cookbook, by putting @safe: pure: nothrow: at the beginning of a module, I distribute it on all definitions, right? Even methods, inner classes, and so on? Because I did just that on half a dozen of modules and the compiler did not complain. Does that mean my code is clean(?) or that what I did has no effect? I've noticed the same thing. If I want pure and nothrow to propage to inner structs and classes I have to place another label inside the class definition. Otherwise only free functions are affected. I had a similar experience when trying to use @nogc. Having to insert @nogc into every struct I use is mildly annoying.
Re: @nogc
On Friday, 11 July 2014 at 06:41:56 UTC, Andrei Alexandrescu wrote: On 7/10/14, 10:07 PM, Philpax wrote: I've run into my own series of trials and tribulations with a @nogc main function (i.e. entire project is @nogc). While the idea and implementation is great, its interaction with druntime/Phobos is lacking. This isn't a complete list - it's only what I remember and can reproduce now: [snip] Please paste into one or more bug reports. Thanks! -- Andrei Will do once I get back to work on that project and come up with test cases.
Re: @nogc
I've run into my own series of trials and tribulations with a @nogc main function (i.e. entire project is @nogc). While the idea and implementation is great, its interaction with druntime/Phobos is lacking. This isn't a complete list - it's only what I remember and can reproduce now: 1. destroy(Object) seems to not call the dtor; I'm not sure this is an issue with 2.066 or nogc, seeing as it happens in 2.065 as well: http://dpaste.dzfl.pl/d0c754bb78c6 - to get around this, I wrote my own destroy that automatically calls __dtor. 2. std.typecons.RefCounted doesn't compile in @nogc as the dtor isn't @nogc. Attempted to annotate it with @nogc, but then this happened: Error: @nogc function 'std.typecons.RefCounted!(Test, cast(RefCountedAutoInitialize)1).RefCounted.~this' cannot call non-@nogc function 'object.destroy!(Test).destroy'. Also attempts to call GC.removeRange, which fails for obvious reasons. Got around this by writing my own ref-counted pointer that uses the destroy replacement from (1). 3. std.container.Array doesn't compile in @nogc as it uses std.typecons.RefCounted. Got around this by writing my own Array type. 4. @nogc code takes on some of the characteristics of nothrow as Phobos/druntime liberally use `throw new Exception` and `enforce`. This leads to a _vast_ majority of the standard library being locked out. This is really one of the killer issues, and it can only be resolved with allowing GC allocations in failure situations (as Walter says) or by pre-allocating exceptions in the stdlib (which is unlikely). Out of curiosity, as I haven't looked at this problem, what does D do differently to C++ that requires heap allocation of exceptions? 5. As a result of (4), even some of the most trivial things don't work. std.stdio.writeln() (i.e. no arguments) fails because of this: enforce(fputc('\n', .stdout._p.handle) == '\n'); There is _no need_ to enforce that \n was actually output! This is absolutely ridiculous! I got around this by writing my own wrapper around printf that doesn't allocate or throw. 6. std.allocator doesn't work with @nogc. Understandable, since it hasn't been updated for @nogc yet. Got around this by starting work on my own allocators. 7. This is more a tangential issue, but still a mild irritant: placing @nogc at a top of a file doesn't cover the entire module - structs and classes also have to be manually tagged @nogc: module test; @nogc: struct Test { @nogc: this() { /* ... */ } } I ran into these issues with GIT HEAD from 2-3 weeks ago. When I resume work on my @nogc project, I'll update to the 2.066 beta/release and report on any more issues. I'm aware that it's early days yet for @nogc, so I'm not fussed about these issues, but they are rather concerning. I considered sending in PRs to resolve some of these problems, but fixing the Exception situation (which many of the above stem from) requires significant work.
Re: @nogc
On Friday, 11 July 2014 at 05:41:50 UTC, Manu via Digitalmars-d wrote: On 11 July 2014 13:45, Walter Bright via Digitalmars-d digitalmars-d@puremagic.com wrote: On 7/10/2014 7:31 PM, Manu via Digitalmars-d wrote: So, we allow assert() in nothrow functions, the argument is that assert is non-recoverable, so it's distinct from user exceptions. I have this in my 'nothrow @nogc' function: assert(false, Message ~ details); It complains Error: cannot use operator ~ in @nogc function I think it should be allowed to invoke the GC for formatting error messages inside of assert statements, just the same as assert() is allowed inside of nothrow functions. Thoughts? I've thought of allowing throw new ..., and yours would be in addition to that, in @nogc functions, but was waiting to see how this would play out a bit first. I should add, I'm not sure I see that my case should be 'in addition'. I think my case should precede since I don't think it's objectionable, but I'm really unsure I would get on board with 'throw new ...' in @nogc functions. It seems to defeat the purpose to me...? Why would you want to allow throwing 'new' exceptions? I also have misgivings about this - while it's the easiest solution (as I noted in my previous post), it's also antithetical to @nogc. If one rips out the GC entirely, these exceptions end up leaking memory which is arguably an even bigger problem, especially on memory-constrained platforms.
Re: DIP64: Attribute Cleanup
+1 to this proposal; as someone trying to annotate their D code appropriately, the inconsistency in the usage of @ forces me to look up the docs every time, which leads to considerable productivity loss. I'm sure it's less of an issue when one is sufficiently versed in annotation, but I find it quite annoying right now.
Re: Cannot alias null
On Friday, 13 June 2014 at 15:05:49 UTC, Tom Browder via Digitalmars-d-learn wrote: On Fri, Jun 13, 2014 at 7:59 AM, via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thursday, 12 June 2014 at 21:07:47 UTC, Tom Browder via Digitalmars-d-learn wrote: What I was really trying to do was D'ify C expressions like this: typedef ((struct t*)0) blah; This doesn't compile for me with GCC, and I don't know what it's supposed to mean. ((struct t*) 0) is a value, not a type... Sorry, you're correct. It is from a C macro and would be used for an rvalue. Something like this: $ cat chdr.h struct t; #define t_nullptr ((struct t*)0) struct t* t_ptr = t_nullptr; After pre-processing with gcc -E -P that should read: $ cat chdr.h.i struct t; struct t* t_ptr = ((struct t*)0); which does compile. So I'm not sure how to translate that into D. I do know my first attempt here doesn't work, even with it being surrounded by extern (C) {}: $ cat chdr.d struct t; struct t* t_ptr = null; Where does it come from? The usage comes from many of the C API headers in the BRL-CAD package (http://brlcad.org). Best, -Tom Remove the struct from the pointer: struct t; t* t_ptr = null;
Re: D Grammar in BNF Text Form?
On Friday, 6 June 2014 at 10:30:14 UTC, Tom Browder via Digitalmars-d wrote: Can anyone point me to a text version of the D grammar in some kind of BNF or EBNF format? The D lang web site's info is close, but it's buried in html which I'ld rather not have to wrestle with. My purpose is to attempt to write a D language parser in Perl using Damian Conway's Regex::Grammars module (on CPAN). Thanks. Best regards, -Tom Check Brian Schott's work: https://github.com/Hackerpilot/DGrammar
Re: What's going on with std.experimental.lexer?
I've been meaning to mention this, but I use std.experimental.lexer in a code generation tool for our project; it's worked well so far, and I'd happily recommend its use. Looking forward to further updates.
Re: D array to c
On Friday, 6 June 2014 at 03:40:41 UTC, Harpo wrote: Hello I need to pass a array in D to c. I have edited the code to the important parts. Normally in C I would just do this: void myFunction(int *array) { } Then pass it a array of whatever size. However I actually need the array to be in a struct so... typedef struct{int* array;} examplestruct; void myFunction(examplestruct parameter){ } On the D end what type structure do I need to use to pass a array of unknown size inside a struct to the c function? I have tried stuff like: struct examplestruct {long* array;} long numar[50]; examplestruct parameters; parameters.array = numuar; When I do that I get type conflictions. Error: cannot implicitly convert expression (numar) of type long[50] to long*... I am not sure what setup I need to have here. Anyone know whats up? Thanks! -Harpo Use numar.ptr to get a long* pointer. Also, are you sure you want to use 64-bit integers on the D side? Are you sure the C compiler is using 64-bit for its integers?
Re: how to detect ctfe
__ctfe can be used for this purpose: The __ctfe boolean pseudo-variable, which evaluates to true at compile time, but false at run time, can be used to provide an alternative execution path to avoid operations which are forbidden at compile time. Every usage of __ctfe is evaluated before code generation and therefore has no run-time cost, even if no optimizer is used. ( http://dlang.org/function.html )
Re: Thank you Kenji
Seeing Kenji at work is amazing. Thanks for all the great work, Kenji!
Re: Livestreaming DConf?
I'd definitely be interested in a stream. Looking forward to watching everyone's talks :)
Local function overloading
Thanks! I used the static struct solution. I did some quick research, and I think that the reason why the original code doesn't work is because the two functions have the same identifier, which results in Dsymboltable::insert rejecting the second function. I haven't tested this hypothesis, but I suspect this to be the case. A simple solution would be to assign unique identifiers to each function, but I haven't experimented with DMD source enough to determine what the side-effects of such a change would be. Is not being able to overload functions in local scope intended behaviour?
Local function overloading
While trying to overload a function in local/function scope, I ran into this behaviour: http://dpaste.dzfl.pl/b4e8b9ddf78a and I was wondering what the cause was. As far as I can tell, this should be fine in global scope (and it is), but I'm curious as to why it doesn't work inside a function.
Re: Typo in Types page
On Sunday, 6 April 2014 at 09:30:47 UTC, Gustavo wrote: In the page http://dlang.org/type.html I believe there is a typo stating that bool is 1 byte instead of 1 bit. While a boolean is by definition a single bit, it is represented by programming languages as a byte for various reasons (including performance, data layout, and interfacing). You can verify that this is the case: http://dpaste.dzfl.pl/8129625be797 As far as I know, this is true for most, if not all, native programming languages. To actually store a value as a single bit, you will have to use bit manipulation.
Re: Should we deprecate comma?
Kill it with fire. It has no purpose in D.
Re: sizeof struct no less than 1?
C++ exhibits the same behaviour for what is most likely the same reason: so that empty structs can be allocated without two distinct objects having the same memory address ( http://stackoverflow.com/questions/2362097/why-is-the-size-of-an-empty-class-in-c-not-zero )
Re: ddox-generated Phobos documentation is available for review
Fantastic! The organization makes it easy to find the right tool for the job. This is probably nitpicking, but in std.algorithm and other modules ( http://dlang.org/library/std/algorithm.html ) there are multiple overloads of the same function (splitter, reverse, etc); it'd be nice if these could be organized into their own sub-categories, so there's no unnecessary visual redundancy. There's also the library list which displays all modules; do the internal modules (druntime, etc) need to be exposed? It might be nicer for the end-user for these to be hidden, or kept in their own category. Otherwise, very nice! :)