Re: TLS

2017-03-09 Thread M-exe via Digitalmars-d-learn
On Friday, 10 March 2017 at 07:17:22 UTC, rikki cattermole wrote: D does not support Windows XP. If you absolutely require it, you will have to contact Walter about support. Let me care about it ;) I just need help with the TLS :)

Re: TLS

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 10/03/2017 8:06 PM, M-exe wrote: On Friday, 10 March 2017 at 06:46:03 UTC, rikki cattermole wrote: On 10/03/2017 7:41 PM, M-exe wrote: I found that D is great language, but for my own reasons I'm trying to use it without TLS at all. Can the TLS directory be avoided? (compiling on windows) I

Re: TLS

2017-03-09 Thread M-exe via Digitalmars-d-learn
On Friday, 10 March 2017 at 06:46:03 UTC, rikki cattermole wrote: On 10/03/2017 7:41 PM, M-exe wrote: I found that D is great language, but for my own reasons I'm trying to use it without TLS at all. Can the TLS directory be avoided? (compiling on windows) I mean, can it avoided without losing

Re: TLS

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 10/03/2017 7:41 PM, M-exe wrote: I found that D is great language, but for my own reasons I'm trying to use it without TLS at all. Can the TLS directory be avoided? (compiling on windows) I mean, can it avoided without losing GC and main language features? I found out that also when with -vt

TLS

2017-03-09 Thread M-exe via Digitalmars-d-learn
I found that D is great language, but for my own reasons I'm trying to use it without TLS at all. Can the TLS directory be avoided? (compiling on windows) I mean, can it avoided without losing GC and main language features? I found out that also when with -vtls there is no output, there is T

Re: DMD default safety command line switch

2017-03-09 Thread XavierAP via Digitalmars-d-learn
On Friday, 10 March 2017 at 01:17:57 UTC, Jack Stouffer wrote: On Friday, 10 March 2017 at 01:13:26 UTC, XavierAP wrote: On Friday, 10 March 2017 at 00:48:39 UTC, Jack Stouffer wrote: Don't know the history, but as recently as a week ago Andrei has argued against such behavior has balkanizing t

Re: DMD default safety command line switch

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 10 March 2017 at 01:13:26 UTC, XavierAP wrote: On Friday, 10 March 2017 at 00:48:39 UTC, Jack Stouffer wrote: Don't know the history, but as recently as a week ago Andrei has argued against such behavior has balkanizing the community. What behavior? Anyway my question is answered, t

Re: DMD default safety command line switch

2017-03-09 Thread XavierAP via Digitalmars-d-learn
On Friday, 10 March 2017 at 01:13:26 UTC, XavierAP wrote: What behavior? Anyway my question is answered, thanks :) What behavior is a rhetorical question, meaning that I don't really want it to be answered 0;)

Re: DMD default safety command line switch

2017-03-09 Thread XavierAP via Digitalmars-d-learn
On Friday, 10 March 2017 at 00:48:39 UTC, Jack Stouffer wrote: Don't know the history, but as recently as a week ago Andrei has argued against such behavior has balkanizing the community. What behavior? Anyway my question is answered, thanks :)

Re: @safe console input?

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 10 March 2017 at 00:42:35 UTC, XavierAP wrote: On Thursday, 9 March 2017 at 23:55:35 UTC, Adam D. Ruppe wrote: Just wrap it in a @trusted function. I knew this answer already of course ;) but I take it as implying that there is no other way. Actually I really wonder why std.stdio

Re: DMD default safety command line switch

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 9 March 2017 at 17:48:04 UTC, XavierAP wrote: Andrei's 2010 book states that the default safety level can be changed from @system to @safe by means of a -safe command line switch, in the case of the DMD compiler. Now I've tried it and it's not recognized. Was this feature remove

Re: @safe console input?

2017-03-09 Thread XavierAP via Digitalmars-d-learn
On Thursday, 9 March 2017 at 23:55:35 UTC, Adam D. Ruppe wrote: Just wrap it in a @trusted function. I knew this answer already of course ;) but I take it as implying that there is no other way. Actually I really wonder why std.stdio.readln() itself is not flagged @trusted. I wouldn't think

Re: can I overload operators as extension methods?

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 23:50:04 UTC, XavierAP wrote: The same way as T.foo() is lowered to foo(T) if no such member is defined inside the type. No. But wrapping in a struct with alias this lets you extend them pretty easily too.

Re: @safe console input?

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 22:53:59 UTC, XavierAP wrote: And more generally, is it possible to get user console input in a @safe way? Just wrap it in a @trusted function.

can I overload operators as extension methods?

2017-03-09 Thread XavierAP via Digitalmars-d-learn
The same way as T.foo() is lowered to foo(T) if no such member is defined inside the type. It would allow me to extend 3rd party types with operator notation without wrapping them. After trying and reading the specification, looks like nuts, but just wanted to confirm. Thx

@safe console input?

2017-03-09 Thread XavierAP via Digitalmars-d-learn
I was surprised by a compiler message saying that std.stdio.readln() (and specifically the overload without arguments) is not safe but @system. Actually I was using it only to pause execution until the user presses Enter. So how else could I do this within a @safe environment? And more gene

Re: Get list of public methods of struct

2017-03-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, March 09, 2017 18:48:22 Adam D. Ruppe via Digitalmars-d-learn wrote: > On Thursday, 9 March 2017 at 18:32:41 UTC, tcak wrote: > > Is there any way to get list of public methods of a struct? > > You can loop through __traits(allMembers, YourStruct) and check > protection, type, etc. >

Re: Get list of public methods of struct

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 18:32:41 UTC, tcak wrote: Is there any way to get list of public methods of a struct? You can loop through __traits(allMembers, YourStruct) and check protection, type, etc. __traits(getMember, YourStruct, "some name") gets one method in particular. allMembers re

Get list of public methods of struct

2017-03-09 Thread tcak via Digitalmars-d-learn
Is there any way to get list of public methods of a struct? I looked at both "traits" and "std.traits". getVirtualFunctions and getVirtualMethods are closest I guess, but they don't seem like general purpose due to "Virtual" part. (Wouldn't it work if a method was final?) I saw "FieldNameTup

Re: DMD default safety command line switch

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 17:48:04 UTC, XavierAP wrote: Was this feature remove on purpose? I could imagine that. Yes, you instead mark individual things @safe (or you can do a @safe { functions here } group or @safe: at the top of a scope). this kinda sucks but alas.

DMD default safety command line switch

2017-03-09 Thread XavierAP via Digitalmars-d-learn
Andrei's 2010 book states that the default safety level can be changed from @system to @safe by means of a -safe command line switch, in the case of the DMD compiler. Now I've tried it and it's not recognized. Was this feature remove on purpose? I could imagine that. The default safety keeps

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 16:40:13 UTC, Suliman wrote: How should I write to file result without \r\n\ symbols? auto x = content.matchFirst(bigCodeBlock); File f = File("foo.txt", "w"); f.write(x); Just f.write(x[0]); to write out the whole hit instead of the collection of references.

Re: Best way to manage non-memory resources in current D, ex: database handles.

2017-03-09 Thread Kagamin via Digitalmars-d-learn
RefCounted is ok If GC methods it calls are legal during collection.

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Suliman via Digitalmars-d-learn
On Thursday, 9 March 2017 at 16:23:23 UTC, Adam D. Ruppe wrote: On Thursday, 9 March 2017 at 16:14:28 UTC, Suliman wrote: But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols... That's just the writeln array formatter. The matchFirst f

Re: Best way to manage non-memory resources in current D, ex: database handles.

2017-03-09 Thread Kagamin via Digitalmars-d-learn
Unique is probably not good for database connection: you then can't have connection in two variables, also if it holds a reference to GC-allocated memory, it can't be put to GC-allocated memory, since when that GC-allocated memory is collected, Unique will try to destroy its possibly already fr

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 10/03/2017 5:14 AM, Suliman wrote: Adding "r" helped: auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols... \r\n is Windows new line characters.

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 9 March 2017 at 16:14:28 UTC, Suliman wrote: But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols... That's just the writeln array formatter. The matchFirst function returns an array of hits (that allows captures, btw you m

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Suliman via Digitalmars-d-learn
Adding "r" helped: auto bigCodeBlock = regex(r"`{3}[\s\S]*?`{3}"); But now output is: [["```\r\nvoid foo()\r\n{\r\n\twriteln(\"ppp\");\r\n}\r\n```"]] But I do not \r\n\ symbols...

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Suliman via Digitalmars-d-learn
On Thursday, 9 March 2017 at 15:22:00 UTC, rikki cattermole wrote: On 10/03/2017 4:17 AM, Suliman wrote: I would use dpaste and write a quick script but here is where I think your problem is: regex("/.*/g") It should be: regex(".*", "g") As per[0]. [0] http://dlang.org/phobos/std_regex.htm

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 10/03/2017 4:17 AM, Suliman wrote: I would use dpaste and write a quick script but here is where I think your problem is: regex("/.*/g") It should be: regex(".*", "g") As per[0]. [0] http://dlang.org/phobos/std_regex.html#.regex Sorry, but what regexp are you talking? There is nothing l

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread Suliman via Digitalmars-d-learn
I would use dpaste and write a quick script but here is where I think your problem is: regex("/.*/g") It should be: regex(".*", "g") As per[0]. [0] http://dlang.org/phobos/std_regex.html#.regex Sorry, but what regexp are you talking? There is nothing like: `regex("/.*/g")` in my code...

Re: Where do you test syntax of D regexp online?

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 10/03/2017 3:50 AM, Suliman wrote: I wrote two regexp: auto inlineCodeBlock = regex("`(.*?)`"); // --> `(.*?)` auto bigCodeBlock = regex("/`{3}[\\s\\S]*?`{3}/g"); // --> `{3}[\s\S]*?`{3} First for for selection inline code block. Second for multi-lin

Where do you test syntax of D regexp online?

2017-03-09 Thread Suliman via Digitalmars-d-learn
I wrote two regexp: auto inlineCodeBlock = regex("`(.*?)`"); // --> `(.*?)` auto bigCodeBlock = regex("/`{3}[\\s\\S]*?`{3}/g"); // --> `{3}[\s\S]*?`{3} First for for selection inline code block. Second for multi-line: #Header my h

Re: core.sys.windows.winldap

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/03/2017 11:52 PM, WebFreak001 wrote: On Thursday, 9 March 2017 at 10:44:00 UTC, rikki cattermole wrote: On 09/03/2017 11:19 PM, WebFreak001 wrote: ... Import libs like static libraries adhere to the same specs of PE-COFF versus OMF. So if you want things to work without much hassle, he

Re: core.sys.windows.winldap

2017-03-09 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 9 March 2017 at 10:44:00 UTC, rikki cattermole wrote: On 09/03/2017 11:19 PM, WebFreak001 wrote: ... Import libs like static libraries adhere to the same specs of PE-COFF versus OMF. So if you want things to work without much hassle, hello -m64! Thanks, adding `--arch=x86_msc

Re: core.sys.windows.winldap

2017-03-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/03/2017 11:19 PM, WebFreak001 wrote: I tried using core.sys.windows.winldap (winldap.h) but I get linker errors when I try to run my code. I tried copying Wldap32.lib from my Windows Kits folder but then optlink always says Error 43 Not a Valid Library File. I simply use `dub test` to comp

Re: Can i using D & LLVM & SDL2 for Android?

2017-03-09 Thread dummy via Digitalmars-d-learn
On Wednesday, 8 March 2017 at 10:24:24 UTC, Joakim wrote: On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote: Just thought. I do want to know. :-) As far as I know is, * LDC2 woring on NDK(yah!) * Native OpenGLES: http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android

core.sys.windows.winldap

2017-03-09 Thread WebFreak001 via Digitalmars-d-learn
I tried using core.sys.windows.winldap (winldap.h) but I get linker errors when I try to run my code. I tried copying Wldap32.lib from my Windows Kits folder but then optlink always says Error 43 Not a Valid Library File. I simply use `dub test` to compile, adding `"libs": ["Wldap32"]` only a