Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 07:38:04 UTC, Mike Parker wrote: On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost

Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost peice of data. This does have an odd consequence though, if you

Re: RAII

2017-02-23 Thread ketmar via Digitalmars-d-learn
Arun Chandrasekaran wrote: On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote: Thanks for your help. NRVO looks interesting. However this may not be RAII after all. Or may be too much of C++ has spoiled me. I am not familiar enough with D to appreciate/question the language design

Re: If you needed any more evidence that memory safety is the future...

2017-02-23 Thread ketmar via Digitalmars-d
Jack Stouffer wrote: This is something that valgrind could have easily picked up, but the devs just didn't use it for some reason. Runtime checking of this stuff is important, so please, don't disable safety checks with DMD if you're dealing with personal info. or, even better: don't

Re: RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 23 February 2017 at 21:05:48 UTC, cym13 wrote: It reminds me of https://w0rp.com/blog/post/an-raii-constructor-by-another-name-is-just-as-sweet/ which isn't what you want but may be interesting anyway. It is interesting, indeed, thanks.

Re: RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote: Arun Chandrasekaran wrote: I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D?

If you needed any more evidence that memory safety is the future...

2017-02-23 Thread Jack Stouffer via Digitalmars-d
https://bugs.chromium.org/p/project-zero/issues/detail?id=1139 A buffer overflow bug caused heartblead 2.0 for hundreds of thousands of sites. Here we are 57 years after ALGOL 60 which had bounds checking, and we're still dealing with bugs from C's massive mistake. This is something that

Re: Big Oversight with readln?

2017-02-23 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 24 February 2017 at 03:45:35 UTC, Nick Sabalausky (Abscissa) wrote: On 02/23/2017 09:43 PM, Jonathan Marler wrote: I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 10:36 PM, Adam D. Ruppe wrote: On Friday, 24 February 2017 at 02:50:27 UTC, Nick Sabalausky (Abscissa) wrote: What I'd kinda like to do is put together a D doc generator that uses, uhh, probably markdown. My dpldocs.info generator continues to progress and I'm almost ready to

[Issue 17220] invalid code with -m32 -inline and struct that's 4x the size of an assigned enum value

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17220 Stefan Koch changed: What|Removed |Added Hardware|x86 |x86_64 --- Comment #1

Re: Big Oversight with readln?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 09:43 PM, Jonathan Marler wrote: I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from $(D stdin) and count words void main() { char[] buf;

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 24 February 2017 at 02:50:27 UTC, Nick Sabalausky (Abscissa) wrote: What I'd kinda like to do is put together a D doc generator that uses, uhh, probably markdown. My dpldocs.info generator continues to progress and I'm almost ready to call it beta and let other people use it.

Re: code.dlang.org major outage

2017-02-23 Thread rikki cattermole via Digitalmars-d
On 24/02/2017 11:55 AM, Sönke Ludwig wrote: The virtual server that is running code.dlang.org has frozen about an hour ago and fails to boot further than to the bootloader. Initial attempts to recover from within Grub have failed and it's unclear what the root cause is. I will instead set up a

Re: Debugging D applications from VS code with webfreak.debug

2017-02-23 Thread Jerry via Digitalmars-d-learn
You can use the C++ plugin, which provides a debugger. Just make sure you aren't using optlink, I don't think it generates compatible files. Also you might need to use "-gc" which generates debug names to be in C format. https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:34 PM, Ali Çehreli wrote: (None of the following is tested.) a) Try using the following macro: COLON = And then use "Note$(COLON) Blah". Thanks, that works. c) Another option: NOTE = Note $0 Then use "$(NOTE Blah)" Actually, that's more or less what I was

[Issue 17220] invalid code with -m32 -inline and struct that's 4x the size of an assigned enum value

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17220 Stefan Koch changed: What|Removed |Added CC||uplink.co...@gmail.com

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:49 PM, H. S. Teoh via Digitalmars-d-learn wrote: I'm becoming more and more convinced that software that tries to be smart ends up being even dumber than before. I've been convinced of that for a long time ;) Not just software either. Anything. My car does idiotic "smart"

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 04:51 PM, Adam D. Ruppe wrote: On Thursday, 23 February 2017 at 21:39:11 UTC, H. S. Teoh Apparently COLON is defined to be ':' in the default ddoc macros, so you needn't define it yourself. Oh yeah. Still, barf. Luckily in my case, the "Word:" part is already generated inside

Big Oversight with readln?

2017-02-23 Thread Jonathan Marler via Digitalmars-d-learn
I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from $(D stdin) and count words void main() { char[] buf; size_t words = 0; while (!stdin.eof)

[Issue 17220] New: invalid code with -m32 -inline and struct that's 4x the size of an assigned enum value

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17220 Issue ID: 17220 Summary: invalid code with -m32 -inline and struct that's 4x the size of an assigned enum value Product: D Version: D2 Hardware: x86 OS: Linux

Re: cost of calling class function

2017-02-23 Thread Chris Wright via Digitalmars-d
On Wed, 22 Feb 2017 18:31:37 -0800, Jonathan M Davis via Digitalmars-d wrote: > On Thursday, February 23, 2017 02:17:02 Jeremy DeHaan via Digitalmars-d > wrote: >> On Thursday, 23 February 2017 at 01:48:40 UTC, Seb wrote: >> > AFAICT though it was approved, the switch to final by default has >> >

Re: code.dlang.org major outage

2017-02-23 Thread Sönke Ludwig via Digitalmars-d
Am 23.02.2017 um 23:55 schrieb Sönke Ludwig: The virtual server that is running code.dlang.org has frozen about an hour ago and fails to boot further than to the bootloader. Initial attempts to recover from within Grub have failed and it's unclear what the root cause is. I will instead set up a

Re: code.dlang.org major outage

2017-02-23 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 23 February 2017 at 22:55:05 UTC, Sönke Ludwig wrote: The virtual server that is running code.dlang.org has frozen about an hour ago and fails to boot further than to the bootloader. Initial attempts to recover from within Grub have failed and it's unclear what the root cause is.

code.dlang.org major outage

2017-02-23 Thread Sönke Ludwig via Digitalmars-d
The virtual server that is running code.dlang.org has frozen about an hour ago and fails to boot further than to the bootloader. Initial attempts to recover from within Grub have failed and it's unclear what the root cause is. I will instead set up a replacement server with the latest backup

Re: ddoc: Can I escape a colon?

2017-02-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Feb 23, 2017 at 01:39:11PM -0800, H. S. Teoh via Digitalmars-d-learn wrote: [...] > Nah, that's overkill. This works: > > Note$(COLON) blah blah blah > > Apparently COLON is defined to be ':' in the default ddoc macros, so > you needn't define it yourself. [...] Bah, I was wrong,

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 23 February 2017 at 21:39:11 UTC, H. S. Teoh Apparently COLON is defined to be ':' in the default ddoc macros, so you needn't define it yourself. Oh yeah. Still, barf.

Re: ddoc: Can I escape a colon?

2017-02-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Feb 23, 2017 at 09:35:41PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Thursday, 23 February 2017 at 21:17:33 UTC, H. S. Teoh wrote: > > _Note: Blah blabbety blah > > Nope. > > Ddoc considers [A-Za-z_]+: to be a section header. You can trick it by > doing something like

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 23 February 2017 at 21:17:33 UTC, H. S. Teoh wrote: _Note: Blah blabbety blah Nope. Ddoc considers [A-Za-z_]+: to be a section header. You can trick it by doing something like /++ Note: ass +/ Yes, the html entity for a space. That trick's ddoc's stupid parser while

Re: ddoc: Can I escape a colon?

2017-02-23 Thread Ali Çehreli via Digitalmars-d-learn
On 02/23/2017 01:04 PM, Nick Sabalausky (Abscissa) wrote: Suppose I want ddoc output to include this line: -- Note: Blah blabbety blah -- But the colon causes "Note" to be considered a section header. Is there a way to escape the ":" so that it's displayed as expected,

Re: ddoc: Can I escape a colon?

2017-02-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Feb 23, 2017 at 04:04:39PM -0500, Nick Sabalausky (Abscissa) via Digitalmars-d-learn wrote: > Suppose I want ddoc output to include this line: > > -- > Note: Blah blabbety blah > -- > > But the colon causes "Note" to be considered a section header. Is > there a

[Issue 17218] foreach on tupleof inside switch returns ref to undefined address

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17218 ZombineDev changed: What|Removed |Added Keywords||wrong-code

Re: RAII

2017-02-23 Thread cym13 via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:52:26 UTC, Arun Chandrasekaran wrote: I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D? ``` import

ddoc: Can I escape a colon?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Suppose I want ddoc output to include this line: -- Note: Blah blabbety blah -- But the colon causes "Note" to be considered a section header. Is there a way to escape the ":" so that it's displayed as expected, but doesn't trigger a section?

[Issue 14413] Spurious newline in ddoc JSON output for multiple successive line doc comments

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14413 Nick Sabalausky changed: What|Removed |Added Resolution|WONTFIX |FIXED ---

Re: DConf 2017 speaking proposals due Feb 28

2017-02-23 Thread Walter Bright via Digitalmars-d-announce
On 2/23/2017 10:54 AM, Steven Schveighoffer wrote: On 2/22/17 6:24 PM, Walter Bright wrote: Feb 28 is coming up fast! Website says 2/26. Which is correct? -Steve Probably 2/26. It's better to not procrastinate anyway.

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
On Thursday, 23 February 2017 at 19:57:18 UTC, Patrick Schluter wrote: Marking the method as @pure changes anything? Here is the link to play with it yourself :-) https://godbolt.org/g/se4dCZ

Re: simple static if / traits question...

2017-02-23 Thread Patrick Schluter via Digitalmars-d-learn
On Thursday, 23 February 2017 at 18:35:29 UTC, Profile Anaysis wrote: [...] option 1 is the one I was shooting for. does the static if (audio) just check for the existence of audio, or does it also check to see if audio is true as well? Yes, but it checks at compile time. So the code

[Issue 11847] Importing "package.d" module causes qualified name lookup to fail for sub modules

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11847 ZombineDev changed: What|Removed |Added CC|

Re: cost of calling class function

2017-02-23 Thread Patrick Schluter via Digitalmars-d
On Thursday, 23 February 2017 at 17:02:55 UTC, Johan Engelen wrote: On Thursday, 23 February 2017 at 16:25:34 UTC, Johan Engelen wrote: [...] We're in good company: both clang and gcc also do not devirtualize the call when the loopcount is too large (when the loop count is 4, the indirect

Re: Checking, whether string contains only ascii.

2017-02-23 Thread berni via Digitalmars-d-learn
On Thursday, 23 February 2017 at 17:44:05 UTC, HeiHon wrote: Generally postscript files may contain binary data. Think of included images or font data. So in postscript files there should normally be no utf-8 encoded text, but binary data are quite usual. Think of postscript files as a

scriptlike v0.9.7: Minor update

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-announce
Minor update to scriptlike (Utility library to help you write script-like programs in D) Aside from a few doc updates, this just fixes deprecation warnings when compiling with DMD 2.072 and up. https://github.com/Abscissa/scriptlike

Re: DConf 2017 speaking proposals due Feb 28

2017-02-23 Thread Ali Çehreli via Digitalmars-d-announce
On 02/23/2017 10:54 AM, Steven Schveighoffer wrote: On 2/22/17 6:24 PM, Walter Bright wrote: Feb 28 is coming up fast! Website says 2/26. Which is correct? -Steve Always the later date... ;) Ali

Re: Enough D to Make a Living?

2017-02-23 Thread Ola Fosheim Grøstad via Digitalmars-d
On Thursday, 23 February 2017 at 17:23:11 UTC, Nick Sabalausky (Abscissa) wrote: And most of those ways being "wrong" or dangerous. And, as you mentioned, certain "right" ways becoming "wrong" seemingly every few years. Not necessarily wrong, but either limited to specific scenarios or

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 18:46:58 UTC, kinke wrote: A constructor is just a factory function with a special name... Wrt. the special name, that's obviously extremely useful for generic templates (containers etc.).

Re: DConf 2017 speaking proposals due Feb 28

2017-02-23 Thread Steven Schveighoffer via Digitalmars-d-announce
On 2/22/17 6:24 PM, Walter Bright wrote: Feb 28 is coming up fast! Website says 2/26. Which is correct? -Steve

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 14:24:14 UTC, Adam D. Ruppe wrote: On Thursday, 23 February 2017 at 10:48:38 UTC, kinke wrote: That's not elegant. You need a factory function for each type containing one of these structs then. A constructor is just a factory function with a special name...

Re: Debugging D applications from VS code with webfreak.debug

2017-02-23 Thread FR via Digitalmars-d-learn
On Thursday, 23 February 2017 at 17:54:09 UTC, FR wrote: gdb is in my path, I can run it from the command line. When I run 'gdb test.exe' (test.exe being the binary placed in my workspace folder), I get the error message "not in executable format: File format not recognized", whether I build

Re: simple static if / traits question...

2017-02-23 Thread Profile Anaysis via Digitalmars-d-learn
There are a few options: 1. static if(audio) 2. version(audio) 3. if (audio) It looks like you are trying to create the version(audio) semantic(if exists then use, else don't). Ultimately, though, if you are trying to make a binary that can either use audio or not depending on where it is

Re: template parameter inference and introspection

2017-02-23 Thread Meta via Digitalmars-d-learn
On Thursday, 23 February 2017 at 18:21:51 UTC, Meta wrote: On Thursday, 23 February 2017 at 16:01:44 UTC, John Colvin wrote: Is there any way to get a reference/alias to the instantiation of a template function that would be called, given certain parameters? I.e. to get the result of whatever

Re: template parameter inference and introspection

2017-02-23 Thread Meta via Digitalmars-d-learn
On Thursday, 23 February 2017 at 16:01:44 UTC, John Colvin wrote: Is there any way to get a reference/alias to the instantiation of a template function that would be called, given certain parameters? I.e. to get the result of whatever template parameter inference (and overload resolution) has

Re: Debugging D applications from VS code with webfreak.debug

2017-02-23 Thread FR via Digitalmars-d-learn
On Thursday, 23 February 2017 at 16:30:08 UTC, WebFreak001 wrote: I don't know how to build mago-mi either, but you can obtain it from the bundle with dlangide https://github.com/buggins/dlangide/releases/download/v0.6.11/dlangide-v0_6_11-bin-win32_x86-magomi-v0_3_1.zip Thanks, that got me

Re: Checking, whether string contains only ascii.

2017-02-23 Thread HeiHon via Digitalmars-d-learn
On Thursday, 23 February 2017 at 08:34:53 UTC, berni wrote: On Wednesday, 22 February 2017 at 21:23:45 UTC, H. S. Teoh wrote: enforce(!s.any!"a > 127"); Puh, it's lot's of possibilities to choose of, now... I thought of something like the foreach-loop but wasn't sure if that is

Re: Enough D to Make a Living?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 02/23/2017 09:24 AM, Ola Fosheim Grøstad wrote: It is not so much about being able to express something as it is about having N different convoluted ways to express the same thing. And most of those ways being "wrong" or dangerous. And, as you mentioned, certain "right" ways becoming

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
On Thursday, 23 February 2017 at 16:25:34 UTC, Johan Engelen wrote: On Wednesday, 22 February 2017 at 23:49:43 UTC, Dušan Pavkov wrote: If the function is outside of class code runs much faster. I'm obviously doing something wrong and would appreciate any help with this. Interesting test

Re: Debugging D applications from VS code with webfreak.debug

2017-02-23 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 23 February 2017 at 16:28:26 UTC, FR wrote: Hi everyone, as the subject says, I'm trying to get a debugger running with visual studio code on windows. I have installed WebFreak001's code-d and debug extensions but fail to figure out how to install a working debugger. The gdb I

Re: cost of calling class function

2017-02-23 Thread Johan Engelen via Digitalmars-d
On Wednesday, 22 February 2017 at 23:49:43 UTC, Dušan Pavkov wrote: If the function is outside of class code runs much faster. I'm obviously doing something wrong and would appreciate any help with this. Interesting test case, thanks :-) Adding "final" to the class method nullifies the

template parameter inference and introspection

2017-02-23 Thread John Colvin via Digitalmars-d-learn
Is there any way to get a reference/alias to the instantiation of a template function that would be called, given certain parameters? I.e. to get the result of whatever template parameter inference (and overload resolution) has occurred? E.g. for some arbitrarily complex foo: static

[Issue 17219] variable shadowing and overload sets

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17219 --- Comment #1 from John Colvin --- One also gets this weirdness: void foo(alias bar)() { static int bar0(T...)(T t) { return 0; } alias bar = bar0; pragma(msg, __traits(identifier, __traits(parent,

[Issue 17219] New: variable shadowing and overload sets

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17219 Issue ID: 17219 Summary: variable shadowing and overload sets Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1

Re: New (page-per-artifact) standard library doc examples are now editable and runnable

2017-02-23 Thread bachmeier via Digitalmars-d-announce
On Saturday, 18 February 2017 at 16:57:33 UTC, Seb wrote: As imho the border doesn't look that bad and for the same reason as above I didn't remove the border. See a visual comparison here: http://imgur.com/a/pElAu Are you or others still in favor of removing the border? I like the first

Re: RAII

2017-02-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 23 February 2017 at 10:48:38 UTC, kinke wrote: That's not elegant. You need a factory function for each type containing one of these structs then. A constructor is just a factory function with a special name... it is almost equal amount of work.

Re: Enough D to Make a Living?

2017-02-23 Thread Ola Fosheim Grøstad via Digitalmars-d
On Thursday, 23 February 2017 at 07:36:11 UTC, Shachar Shemesh wrote: That is a matter of perspective. I, for one, feel other languages put too much constraints on, making me work quite hard to get what I want expressed in the language, often blocking me from the most efficient implementation

Need a fancy domain for your project? .dub.pm has you covered!

2017-02-23 Thread Seb via Digitalmars-d-announce
Hey all, As I own dub.pm since a year and it hasn't been used much, I have just configured automatic sub-domain rewriting, s.t. everyone can have nice and fancy URLs. All sub-domains get redirected to their respective DUB package page, so now you can browse e.g. eventcore.dub.pm

[Issue 17164] [REG 2.072.0] undefined identifier '__va_argsave'

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17164 --- Comment #2 from Jacob Carlborg --- It's documented for D1 [1], under "C-style Variadic Functions". I still think it's a regressions, this code originated from D1. [1] http://www.digitalmars.com/d/1.0/function.html --

[Issue 17218] foreach on tupleof inside switch returns ref to undefined address

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17218 Alex Goltman changed: What|Removed |Added Hardware|x86 |x86_64

[Issue 17218] New: foreach on tupleof inside switch returns ref to undefined address

2017-02-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17218 Issue ID: 17218 Summary: foreach on tupleof inside switch returns ref to undefined address Product: D Version: D2 Hardware: x86 OS: Mac OS X Status:

Re: RAII

2017-02-23 Thread Adrian Matoga via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:52:26 UTC, Arun Chandrasekaran wrote: I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D? static opCall()

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote: Arun Chandrasekaran wrote: Is there an elegant way to achieve this in D? why not static method or free function that returns struct? due to NRVO[0] it won't even be copied. That's not elegant. You need a factory function for each

Re: JustQuestion: Are 'D' had a browser library?

2017-02-23 Thread dummy via Digitalmars-d-learn
On Sunday, 19 February 2017 at 09:21:40 UTC, aberba wrote: On Sunday, 19 February 2017 at 08:01:56 UTC, dummy wrote: [...] You can use any D lib with http GET support (Vibe.d[1]: download, requests[2]) at code.dlang.org. arsd.dom[3] has dom parsing support. or use any XML lib. [1]

Re: RAII

2017-02-23 Thread ketmar via Digitalmars-d-learn
Arun Chandrasekaran wrote: I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D? why not static method or free function that returns struct? due

RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D? ``` import core.sys.posix.pthread; import core.sys.posix.sys.types; /// Makes

Re: Threads not garbage collected ?

2017-02-23 Thread Guillaume Piolat via Digitalmars-d
On Wednesday, 22 February 2017 at 11:29:27 UTC, Alex wrote: The point is that the thread object could be 20 layers of encapsulation down in a library. The thread could also be added 20 layers down long after the main function was written and tested. Here is what works for me: - having a

Re: Checking, whether string contains only ascii.

2017-02-23 Thread berni via Digitalmars-d-learn
On Wednesday, 22 February 2017 at 21:23:45 UTC, H. S. Teoh wrote: enforce(!s.any!"a > 127"); Puh, it's lot's of possibilities to choose of, now... I thought of something like the foreach-loop but wasn't sure if that is correct for all utf encodings. All in all, I think I take the