Re: For those ready to take the challenge

2015-01-10 Thread via Digitalmars-d-learn
On Friday, 9 January 2015 at 17:18:43 UTC, Adam D. Ruppe wrote: Huh, looking at the answers on the website, they're mostly using regular expressions. Weaksauce. And wrong - they don't find ALL the links, they find the absolute HTTP urls! Yeah... Surprising, since languages like python

Re: For those ready to take the challenge

2015-01-10 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:13:27 UTC, Adam D. Ruppe wrote: On Saturday, 10 January 2015 at 12:34:42 UTC, Tobias Pankrath wrote: Since it is a comparison of languages it's okay to match the original behaviour. I don't think this is really a great comparison of languages either though

Re: For those ready to take the challenge

2015-01-10 Thread Paulo Pinto via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:52:21 UTC, Tobias Pankrath wrote: ... The thing is, in languages like Perl, Python, Ruby (to name a few), reusing someone else's code is not only easy, but it is how most people actually write code most of the time. I think he's wrong, because it spoils

Re: For those ready to take the challenge

2015-01-10 Thread via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:52:21 UTC, Tobias Pankrath wrote: I think he's wrong, because it spoils the comparison. Every answer should delegate those tasks to a library that Stroustroup used as well, e.g. regex matching, string to number conversion and some kind of TCP sockets. But it

Re: For those ready to take the challenge

2015-01-10 Thread Nordlöw
On Friday, 9 January 2015 at 17:15:43 UTC, Adam D. Ruppe wrote: import arsd.dom; import std.net.curl; import std.stdio, std.algorithm; void main() { auto document = new Document(cast(string) get(http://www.stroustrup.com/C++.html;));

Re: core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-10 Thread John Colvin via Digitalmars-d-learn
On Saturday, 10 January 2015 at 12:16:24 UTC, ref2401 wrote: I learned how 'atomicOp' and 'cas' work and why i need them from the following sources: http://ddili.org/ders/d.en/concurrency_shared.html (Ali's book) http://www.informit.com/articles/article.aspx?p=1609144 (Andrei's book) Can

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 17:23:31 UTC, Ola Fosheim Grøstad wrote: For the challenge to make sense it would entail parsing all legal HTML5 documents, extracting all resource links, converting them into absolute form and printing them one per line. With no hickups. Though, that's still

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:52:21 UTC, Tobias Pankrath wrote: But it must do the same work that he's solution does: Create and parse HTML header and extract the html links, probably using regex, but I wouldn't mind another solution. Yeah, that would be best. BTW interesting line here:

Re: For those ready to take the challenge

2015-01-10 Thread bearophile via Digitalmars-d-learn
Adam D. Ruppe: Don't use git master :P Is the issue in Bugzilla? Bye, bearophile

Re: For those ready to take the challenge

2015-01-10 Thread Daniel Kozak via Digitalmars-d-learn
Vladimir Panteleev via Digitalmars-d-learn píše v So 10. 01. 2015 v 07:42 +: On Saturday, 10 January 2015 at 02:10:04 UTC, Jesse Phillips wrote: On Friday, 9 January 2015 at 13:50:29 UTC, eles wrote:

core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-10 Thread ref2401 via Digitalmars-d-learn
I learned how 'atomicOp' and 'cas' work and why i need them from the following sources: http://ddili.org/ders/d.en/concurrency_shared.html (Ali's book) http://www.informit.com/articles/article.aspx?p=1609144 (Andrei's book) Can anybody tell me how 'atomicFence', 'atomicLoad' and

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 12:34:42 UTC, Tobias Pankrath wrote: Since it is a comparison of languages it's okay to match the original behaviour. I don't think this is really a great comparison of languages either though because it is gluing together a couple library tasks. Only a few

Traits and functions

2015-01-10 Thread Bauss via Digitalmars-d-learn
Is there a way to get all functions within a module using traits? I tried allMembers and it seem to work, but I can't use getFunctionAttributes with it and if I use getAttributes then it won't find any applied attributes. What I do is having a package module with a staic constructor which

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 13:22:57 UTC, Nordlöw wrote: on dmd git master. Ideas anyone? Don't use git master :P Definitely another regression. That line was just pushed to git like two weeks ago and the failing assertion is pretty obviously a pure dmd code bug, it doesn't know the

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:24:45 UTC, bearophile wrote: Is the issue in Bugzilla? https://issues.dlang.org/show_bug.cgi?id=13966

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 15:24:45 UTC, bearophile wrote: Is the issue in Bugzilla? I don't know, bugzilla is extremely difficult to search. I guess I'll post it again and worst case it will be closed as a duplicate.

Re: For those ready to take the challenge

2015-01-10 Thread Tobias Pankrath via Digitalmars-d-learn
On Friday, 9 January 2015 at 17:18:43 UTC, Adam D. Ruppe wrote: Huh, looking at the answers on the website, they're mostly using regular expressions. Weaksauce. And wrong - they don't find ALL the links, they find the absolute HTTP urls! Since it is a comparison of languages it's okay to

Re: For those ready to take the challenge

2015-01-10 Thread MattCoder via Digitalmars-d-learn
On Friday, 9 January 2015 at 13:50:29 UTC, eles wrote: https://codegolf.stackexchange.com/questions/44278/debunking-stroustrups-debunking-of-the-myth-c-is-for-large-complicated-pro From the link: Let's show Stroustrup what small and readable program actually is. Alright, there are a lot a

Re: For those ready to take the challenge

2015-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 10 January 2015 at 19:17:22 UTC, Ola Fosheim Grøstad wrote: Nice and clean code; does it expand html entities (amp)? Of course. It does it both ways: spana amp;/span span.innerText == a span.innerText = a \ b; assert(span.innerHTML == a quot; b); parseGarbage also tries to

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-10 Thread Laeeth Isharc via Digitalmars-d-learn
Small recommendation (apart from the reserved word issue which you fixed): it's generally considered good D style to give structs and classes names that start with capital letters, JustLikeThis. So, I suggest Node rather than node. Very minor point, and of course, your code is yours to style

Re: Wrapping a C library with its own GC + classes vs refcounted structs

2015-01-10 Thread Laeeth Isharc via Digitalmars-d-learn
Hi Aldanor. I wrote a slightly longer reply, but mislaid the file somewhere. I guess your question might relate to wrapping the HDF5 library - something that I have already done in a basic way, although I welcome your project, as no doubt we will get to a higher quality eventual solution

Re: endsWith - for a string vs an array of strings

2015-01-10 Thread bearophile via Digitalmars-d-learn
Laeeth Isharc: I understand from previous discussion there is some difficulty over immutability. I did not quite figure out what the solution was in this case: import std.array; import std.string; import std.stdio; void main(string[] args) { string[] test=[1,two,three!];

Re: endsWith - for a string vs an array of strings

2015-01-10 Thread FG via Digitalmars-d-learn
On 2015-01-10 at 21:58, bearophile wrote: Needles is not an array type, it's a type tuple, so withOneOfThese doesn't accept an array of strings. [...] So if you really want to pack the strings in some kind of unity, you can do this as workaround: [...] I would suggest create a function that

endsWith - for a string vs an array of strings

2015-01-10 Thread Laeeth Isharc via Digitalmars-d-learn
I understand from previous discussion there is some difficulty over immutability. I did not quite figure out what the solution was in this case: import std.array; import std.string; import std.stdio; void main(string[] args) { string[] test=[1,two,three!]; auto

Re: For those ready to take the challenge

2015-01-10 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 10 January 2015 at 14:56:09 UTC, Adam D. Ruppe wrote: On Saturday, 10 January 2015 at 13:22:57 UTC, Nordlöw wrote: on dmd git master. Ideas anyone? Don't use git master :P Do use git master. The more people do, the fewer regressions will slip into the final release. You can

Re: For those ready to take the challenge

2015-01-10 Thread via Digitalmars-d-learn
On Saturday, 10 January 2015 at 17:39:17 UTC, Adam D. Ruppe wrote: Though, that's still a library thing rather than a language thing. It is a language-library-platform thing, things like how composable the eco system is would be interesting to compare. But it would be unfair to require a

Re: Traits and functions

2015-01-10 Thread Ali Çehreli via Digitalmars-d-learn
On 01/10/2015 08:21 AM, Bauss wrote: Is there a way to get all functions within a module using traits? I tried allMembers and it seem to work, but I can't use getFunctionAttributes with it and if I use getAttributes then it won't find any applied attributes. What I do is having a package module

Re: endsWith - for a string vs an array of strings

2015-01-10 Thread bearophile via Digitalmars-d-learn
Laeeth Isharc: In D there is a feature that allows a function to accept both an array of items and items, yes - it is funny there is not an overloading that accepts arrays I meant this D feature: void foo(T)(T[] items...) { import std.stdio; items.writeln; } void main() {

Re: Wrapping a C library with its own GC + classes vs refcounted structs

2015-01-10 Thread aldanor via Digitalmars-d-learn
On Saturday, 10 January 2015 at 20:55:05 UTC, Laeeth Isharc wrote: Hi Aldanor. I wrote a slightly longer reply, but mislaid the file somewhere. I guess your question might relate to wrapping the HDF5 library - something that I have already done in a basic way, although I welcome your

Re: Traits and functions

2015-01-10 Thread Bauss via Digitalmars-d-learn
On Saturday, 10 January 2015 at 23:23:52 UTC, Ali Çehreli wrote: On 01/10/2015 08:21 AM, Bauss wrote: Is there a way to get all functions within a module using traits? I tried allMembers and it seem to work, but I can't use getFunctionAttributes with it and if I use getAttributes then it