Re: std.range.byLine

2014-09-10 Thread Nordlöw
On Wednesday, 10 September 2014 at 22:45:08 UTC, Nordlöw wrote: auto byLine(Range)(Range input) if (isForwardRange!Range) { import std.algorithm: splitter; import std.ascii: newline; static if (newline.length == 1) { return input.splitter(newline.front); } else

Re: std.range.byLine

2014-09-10 Thread Nordlöw
On Wednesday, 10 September 2014 at 22:29:55 UTC, Ali Çehreli wrote: assert("foo\nbar\n" .splitter(newline) .filter!(a => !a.empty) .equal([ "foo", "bar" ])); } Ali Ok, great. So I got. auto byLine(Range)(Range input) if (isForwardRange!Range) { import

Re: std.range.byLine

2014-09-10 Thread Ali Çehreli via Digitalmars-d-learn
On 09/10/2014 02:06 PM, "Nordlöw" wrote: I'm missing a range variant of byLine that can operate on strings instead of just File. This is such a common feature so I believe it should have its place in std.range. My suggestion is to define this using splitter!(std.uni.isNewline) but I'm missing

Re: Downloading Files in D

2014-09-10 Thread Adam D. Ruppe via Digitalmars-d-learn
The curl one should be easiest for just downloading files. The big problems with it are that it can be a pain to get the library working with versioning and stuff and that it sometimes does the wrong thing in advanced use cases. But if the curl library works for you at all, doing downloading

Downloading Files in D

2014-09-10 Thread Nordlöw
What's the recommended way to to download files (typically over http(s) or ftp) from within D? Should I use http://dlang.org/phobos/std_net_curl.html or vibed.org ? I'm asking because I've read somewhere that there have been complaints about the curl wrapper.

std.range.byLine

2014-09-10 Thread Nordlöw
I'm missing a range variant of byLine that can operate on strings instead of just File. This is such a common feature so I believe it should have its place in std.range. My suggestion is to define this using splitter!(std.uni.isNewline) but I'm missing std.uni.isNewline. I'm guessing the p

Re: std.range.byLine

2014-09-10 Thread Nordlöw
On Wednesday, 10 September 2014 at 21:06:30 UTC, Nordlöw wrote: This is such a common feature so I believe it should have its place in std.range. Or some other Phobos module.

Re: dgui - Button continually repainting

2014-09-10 Thread andre via Digitalmars-d-learn
Hi, Just noticed there is an event drawItem whichs is called on WM_DRAWITEM. Class core.controls.ownerdrawcontrol.d is very interesting. This event seems more suitable. Kind regards André On Wednesday, 10 September 2014 at 07:19:53 UTC, Mike James wrote: // Please file this issue also on th

Re: symbolless stack allocation

2014-09-10 Thread Ali Çehreli via Digitalmars-d-learn
On 09/10/2014 11:31 AM, Jay wrote: > as specified here: > http://wiki.dlang.org/Memory_Management#Allocating_Class_Instances_On_The_Stack > > > i can allocate a class instance on the stack (inside a funtion) like so: > > scope c = new C(); That usage of 'scope' is deprecated. There is std.ty

symbolless stack allocation

2014-09-10 Thread Jay via Digitalmars-d-learn
as specified here: http://wiki.dlang.org/Memory_Management#Allocating_Class_Instances_On_The_Stack i can allocate a class instance on the stack (inside a funtion) like so: scope c = new C(); i want to create an instance, call one of its methods, and throw it away. like so: scope new C().d

Re: DUB: link to local library

2014-09-10 Thread rcor via Digitalmars-d-learn
I think I recently saw something like: "dependencies": { "dallegro5": { "version": "~master", "path": "../path/to/your/lib" } } Although I haven't tried it yet. Bye, Jeroen I believe you're talking about this: https://github.com/D-Programming-Language/dub/issues/119 and unfortunatel

Re: DUB: link to local library

2014-09-10 Thread JD via Digitalmars-d-learn
DAllegro5 doesn't have an official dub package yet, but I threw together one that could build the library and added it with `dub add-local`. It now shows up in `dub list`, but adding: "dependencies": { "dallegro5": "~master" } I think I recently saw something like: "dependencies": {

Re: DUB: link to local library

2014-09-10 Thread rcor via Digitalmars-d-learn
On Wednesday, 10 September 2014 at 16:26:07 UTC, andre wrote: Dub command line supports something like Dub add-local. Then you can use the package directly. Kind regards Andre DAllegro5 doesn't have an official dub package yet, but I threw together one that could build the library and added

Re: DUB: link to local library

2014-09-10 Thread rcor via Digitalmars-d-learn
On Wednesday, 10 September 2014 at 15:40:11 UTC, Edwin van Leeuwen wrote: On Wednesday, 10 September 2014 at 13:40:16 UTC, rcor wrote: dub.json contains what I think should do the same as above: { "name": "test", "importPaths": ["ext/dallegro5"], "lflags": ["-Lext/dallegro5"] } Does adding:

Re: DUB: link to local library

2014-09-10 Thread andre via Digitalmars-d-learn
Dub command line supports something like Dub add-local. Then you can use the package directly. Kind regards Andre On Wednesday, 10 September 2014 at 15:40:11 UTC, Edwin van Leeuwen wrote: On Wednesday, 10 September 2014 at 13:40:16 UTC, rcor wrote: dub.json contains what I think should do th

Re: DUB: link to local library

2014-09-10 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 10 September 2014 at 13:40:16 UTC, rcor wrote: dub.json contains what I think should do the same as above: { "name": "test", "importPaths": ["ext/dallegro5"], "lflags": ["-Lext/dallegro5"] } Does adding: "libs": ["dallegro5"] make a difference? Cheers, Edwin

Re: UFCS doesn't work in some cases

2014-09-10 Thread ketmar via Digitalmars-d-learn
On Wed, 10 Sep 2014 13:58:18 + Danyal Zia via Digitalmars-d-learn wrote: > Apparently it is a bug that UFCS doesn't work with 'with' > statement. my fault, i thought that it shouldn't. i'm still not Guru. too bad, will work. ;-) signature.asc Description: PGP signature

Re: UFCS doesn't work in some cases

2014-09-10 Thread Danyal Zia via Digitalmars-d-learn
On Tuesday, 9 September 2014 at 18:46:31 UTC, ketmar via Digitalmars-d-learn wrote: UFCS is not working for nested functions. this is not a bug, it was designed this way. the same for 'with', i believe. Apparently it is a bug that UFCS doesn't work with 'with' statement. https://issues.dlang.o

DUB: link to local library

2014-09-10 Thread rcor via Digitalmars-d-learn
I'd like to link to DAllegro5, which doesn't have an official dub package yet. My project structure looks like this: -- ext/ dallegro5/ allegro5/< d bindings that need to be imported libdallegro5.a <-- library I need to link to src/ app.d <

Re: dgui - Button continually repainting

2014-09-10 Thread Mike James via Digitalmars-d-learn
// Please file this issue also on the dgui bibucket home page. Kind regards Andre // Done. Regards, -=mike=-