Re: UFCS with implicit "this" ?

2016-08-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 09, 2016 05:13:44 cy via Digitalmars-d-learn wrote: > I really like UFCS, which is to say, defining functions outside > the class/struct to operate on it, but you can still say > object.function(...) and it'll get rewritten into > function(object,...). > > Only sticky point is

UFCS with implicit "this" ?

2016-08-08 Thread cy via Digitalmars-d-learn
I really like UFCS, which is to say, defining functions outside the class/struct to operate on it, but you can still say object.function(...) and it'll get rewritten into function(object,...). Only sticky point is the convenience of "this". Like I can go struct A { bool a;

Re: Pass RegexMatch to a function?

2016-08-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 09, 2016 01:07:53 Gerald via Digitalmars-d-learn wrote: > I have a RegexMatch that I want to pass to a function that takes > the match and replaces various tokens in a string with the match > and/or individual groups of the match. I'm struggling to figure > out how to pass a

Pass RegexMatch to a function?

2016-08-08 Thread Gerald via Digitalmars-d-learn
I have a RegexMatch that I want to pass to a function that takes the match and replaces various tokens in a string with the match and/or individual groups of the match. I'm struggling to figure out how to pass a RegexMatch to a function, right now I have code like the follows: RegexMatch

Re: encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/09/2016 12:05 AM, Alexsej wrote: //header from server server: nginx date: Mon, 08 Aug 2016 22:02:15 GMT content-type: text/xml; Charset=utf-8 content-length: 204 connection: keep-alive vary: Accept-Encoding cache-control: private expires: Mon, 08 Aug 2016 22:02:15 GMT set-cookie:

Re: encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread Alexsej via Digitalmars-d-learn
On Monday, 8 August 2016 at 21:11:26 UTC, ag0aep6g wrote: On 08/08/2016 09:57 PM, Alexsej wrote: // content in ISO-8859-1 to UTF-8 encoding but I lose //the Cyrillic "отсутствует или неверно задан параметр" // I get it "отсутствует или неверно задан

Re: encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 11:11 PM, ag0aep6g wrote: Why on earth does transcode only accept immutable characters for input? https://github.com/dlang/phobos/pull/4722

Re: encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread Alexsej via Digitalmars-d-learn
On Monday, 8 August 2016 at 21:11:26 UTC, ag0aep6g wrote: On 08/08/2016 09:57 PM, Alexsej wrote: // content in ISO-8859-1 to UTF-8 encoding but I lose //the Cyrillic "отсутствует или неверно задан параметр" // I get it "отсутствует или неверно задан

arrays, mmu, addressing choices

2016-08-08 Thread Charles Hixson via Digitalmars-d-learn
I have a rather large array that I intend to build. but much of it will only occasionally be used. Will the unused sections automatically be paged out? If it matters my system is Debian Linux. This array will be indexed by a ulong. Is there any reasonable maximum size? I've considered

Re: encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 09:57 PM, Alexsej wrote: // content in ISO-8859-1 to UTF-8 encoding but I lose //the Cyrillic "отсутствует или неверно задан параметр" // I get it "отсутствует или неверно задан параметр" // How do I change the encoding to UTF-8

Re: How do i convert this Makefile to dub

2016-08-08 Thread drug007 via Digitalmars-d-learn
On 08.08.2016 21:48, Adil wrote: On Monday, 8 August 2016 at 18:45:35 UTC, drug007 wrote: On 08.08.2016 21:35, Adil wrote: On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: [...] One minor addition. I use the Makefile in our CI tool, that inserts auto-increment numbers in place of git

encoding ISO-8859-1 to UTF-8 in std.net.curl

2016-08-08 Thread Alexsej via Digitalmars-d-learn
import std.stdio; import std.net.curl; void main() { string url = "www.site.ru/xml/api.asp"; string data = " 59538 ... "; auto http = HTTP();

Re: How do i convert this Makefile to dub

2016-08-08 Thread Adil via Digitalmars-d-learn
On Monday, 8 August 2016 at 18:45:35 UTC, drug007 wrote: On 08.08.2016 21:35, Adil wrote: On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: [...] One minor addition. I use the Makefile in our CI tool, that inserts auto-increment numbers in place of git hashes. Numbers are a familiar.

Re: How do i convert this Makefile to dub

2016-08-08 Thread drug007 via Digitalmars-d-learn
On 08.08.2016 21:35, Adil wrote: On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: I have a Makefile setup that I use to return the latest git tag/commit from within my program. The setup is as below: VERSIONED_LIB = myversion.d && rm -f myversion.d VERSION_STRING ?= $(shell git

Re: How do i convert this Makefile to dub

2016-08-08 Thread Adil via Digitalmars-d-learn
On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: I have a Makefile setup that I use to return the latest git tag/commit from within my program. The setup is as below: VERSIONED_LIB = myversion.d && rm -f myversion.d VERSION_STRING ?= $(shell git rev-parse --short HEAD) makeVersion:

How do i convert this Makefile to dub

2016-08-08 Thread Adil via Digitalmars-d-learn
I have a Makefile setup that I use to return the latest git tag/commit from within my program. The setup is as below: VERSIONED_LIB = myversion.d && rm -f myversion.d VERSION_STRING ?= $(shell git rev-parse --short HEAD) makeVersion: echo "module compileConfig; public string

Re: string mixup problem with stdin.byLine

2016-08-08 Thread Meta via Digitalmars-d-learn
On Monday, 8 August 2016 at 07:09:55 UTC, torea wrote: On Monday, 8 August 2016 at 05:17:24 UTC, Dave Akers wrote: I do believe your problem is with the line... On Monday, 8 August 2016 at 02:44:20 UTC, torea wrote: string cleanLine = strip( cast(string)line ); It's casting a char[] to

Re: string mixup problem with stdin.byLine

2016-08-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 August 2016 at 07:09:55 UTC, torea wrote: On Monday, 8 August 2016 at 05:17:24 UTC, Dave Akers wrote: I do believe your problem is with the line... On Monday, 8 August 2016 at 02:44:20 UTC, torea wrote: string cleanLine = strip( cast(string)line ); It's casting a char[] to

Re: method static-ness has no effect on the type?

2016-08-08 Thread Cauterite via Digitalmars-d-learn
On Monday, 8 August 2016 at 10:21:47 UTC, ag0aep6g wrote: Also thanks for submitting the bug for me.

Re: method static-ness has no effect on the type?

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 12:14 PM, Cauterite wrote: On Monday, 8 August 2016 at 10:05:58 UTC, ag0aep6g wrote: The first assert compares the return types of f1 and f2. They both return `void`, so everything's fine there. I think you're mistaken about this. typeof(S.f1) definitely gives the type of the

Re: Question regarding Base64 decoding

2016-08-08 Thread Johannes Loher via Digitalmars-d-learn
Am 02.08.2016 um 00:47 schrieb Seb: > On Monday, 1 August 2016 at 08:53:30 UTC, Kagamin wrote: >> A bug. > > ... which should be filled at Bugzilla and/or fixed. Thanks! :) I created a pullrequest: https://github.com/dlang/phobos/pull/4720

Re: Cannot distinguish between template function wtih 0 args and 1 arg

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 04:36 AM, Engine Machine wrote: This really makes no sense Error: template Mem cannot deduce function from argument types !(cast(eException)1280L, "main.d", 38u, "main.WinMain")(int), candidates are: Mem(T, B = eX, string file = __FILE__, uint line = __LINE__, string func =

Re: method static-ness has no effect on the type?

2016-08-08 Thread Cauterite via Digitalmars-d-learn
On Monday, 8 August 2016 at 10:05:58 UTC, ag0aep6g wrote: The first assert compares the return types of f1 and f2. They both return `void`, so everything's fine there. I think you're mistaken about this. typeof(S.f1) definitely gives the type of the function, not of the return. Try it out:

Re: method static-ness has no effect on the type?

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 10:30 AM, Cauterite wrote: See: https://dpaste.dzfl.pl/2ec6780d4b25 That code is short enough to post it here directly. For easier reference, this is it: struct S { void f1() { auto x = }; static void f2() {

Re: Tracking memory usage

2016-08-08 Thread Cauterite via Digitalmars-d-learn
On Sunday, 7 August 2016 at 00:28:40 UTC, Alfred Pincher wrote: this is a very nice feature. I hope D has something similar? If you want to implement that kind of allocation tracking you'll probably want to use gc_getProxy()+gc_setProxy(). They're global C functions you can access by

Re: callback craziness

2016-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2016 02:42 AM, Engine Machine wrote: So, what about passing in the lambda verses the temp variable? Nothing. I didn't see a case where it worked one way but not the other. If you have code where adding a variable makes things work, please post a complete test case. [...] My code

method static-ness has no effect on the type?

2016-08-08 Thread Cauterite via Digitalmars-d-learn
See: https://dpaste.dzfl.pl/2ec6780d4b25 We have two methods defined, f1 and f2, where f2 is static but they have otherwise identical signatures. We can see from the disassembly that f1 receives a `this` pointer while f2 does not. Yet, typeof() == typeof(). This makes no sense, how can the

Re: Cannot distinguish between template function wtih 0 args and 1 arg

2016-08-08 Thread Cauterite via Digitalmars-d-learn
On Monday, 8 August 2016 at 02:36:24 UTC, Engine Machine wrote: Error: template Mem cannot deduce function from argument types !(cast(eException)1280L, "main.d", 38u, "main.WinMain")(int), candidates are: Mem(T, B = eX, string file = __FILE__, uint line = __LINE__, string func =

Re: string mixup problem with stdin.byLine

2016-08-08 Thread torea via Digitalmars-d-learn
On Monday, 8 August 2016 at 05:17:24 UTC, Dave Akers wrote: I do believe your problem is with the line... On Monday, 8 August 2016 at 02:44:20 UTC, torea wrote: string cleanLine = strip( cast(string)line ); It's casting a char[] to and immutable(char)[], causing the mutable buffer from