Re: Interior pointers and fast GC

2017-01-22 Thread Shachar Shemesh via Digitalmars-d
On 21/01/17 17:30, Nick Treleaven wrote: On Saturday, 14 January 2017 at 15:30:42 UTC, Rainer Schuetze wrote: In addition, you need to lookup the pool anyway to figure out if the pointer points to non-managed memory (stack, global data, malloc'd memory). Makes me wonder about a GC'd language w

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread Basile B. via Digitalmars-d
On Monday, 23 January 2017 at 00:03:44 UTC, FatalCatharsis wrote: On Sunday, 22 January 2017 at 23:20:27 UTC, Basile B. wrote: One way to do this is not to do anything special for q{. [...] This is for tooling, but I still want it to be accurate. Are you suggesting I could move handling toke

Re: A safer File.readln

2017-01-22 Thread Andrei Alexandrescu via Digitalmars-d
On 1/22/17 8:52 PM, Chris Wright wrote: The /dev/zero version at least could be solved by calling stat on the file and limiting reads to the reported size. I recall reported size for special files is zero. We special case std.file.read for those. -- Andrei

Re: A safer File.readln

2017-01-22 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 21:29:39 +, Markus Laker wrote: > It's pretty easy to DoS a D program that uses File.readln or > File.byLine: The /dev/zero version at least could be solved by calling stat on the file and limiting reads to the reported size.

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread FatalCatharsis via Digitalmars-d
On Monday, 23 January 2017 at 01:40:28 UTC, Chris Wright wrote: On Mon, 23 Jan 2017 00:46:30 +, Profile Anaysis wrote: But this is ok because parsers are recursive in nature, so you just have to have your rule be able to terminate in a logical way. Except it's part of the lexer, and most

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread FatalCatharsis via Digitalmars-d
On Monday, 23 January 2017 at 00:46:30 UTC, Profile Anaysis wrote: The real issue is ambiguity. Any time you have a cycle you must be able to get out of it and so your rules must be organized so that one always checks to see if termination has occurred before checking for nesting. If you allow,

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread Chris Wright via Digitalmars-d
On Mon, 23 Jan 2017 00:46:30 +, Profile Anaysis wrote: > But this is ok because parsers are recursive in nature, so you just have > to have your rule be able to terminate in a logical way. Except it's part of the lexer, and most people (such as those creating the JFlex lexer generator) assume

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread Profile Anaysis via Digitalmars-d
On Sunday, 22 January 2017 at 22:11:08 UTC, FatalCatharsis wrote: I'm writing a flex lexer for D and I've hit a roadblock. It is almost working EXCEPT for one specific production. StringLiteral is cyclic and I don't know how to approach it. It is cyclic because: Token -> StringLiteral -

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread FatalCatharsis via Digitalmars-d
On Sunday, 22 January 2017 at 23:20:27 UTC, Basile B. wrote: One way to do this is not to do anything special for q{. Just add a token for q{ and continue normal lexing. The token string content must be valid tokens so it should work. In facts it depends on what the scanner just be used for.

Re: Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread Basile B. via Digitalmars-d
On Sunday, 22 January 2017 at 22:11:08 UTC, FatalCatharsis wrote: I'm writing a flex lexer for D and I've hit a roadblock. It is almost working EXCEPT for one specific production. StringLiteral is cyclic and I don't know how to approach it. It is cyclic because: Token -> StringLiteral -

Writing a JFlex lexer for D - have an issue with cycles

2017-01-22 Thread FatalCatharsis via Digitalmars-d
I'm writing a flex lexer for D and I've hit a roadblock. It is almost working EXCEPT for one specific production. StringLiteral is cyclic and I don't know how to approach it. It is cyclic because: Token -> StringLiteral -> TokenString -> Token To break the cycle, I was thinking I could

A safer File.readln

2017-01-22 Thread Markus Laker via Digitalmars-d
It's pretty easy to DoS a D program that uses File.readln or File.byLine: msl@james:~/d$ prlimit --as=40 time ./tinycat.d tinycat.d #!/usr/bin/rdmd import std.stdio; void main(in string[] argv) { foreach (const filename; argv[1..$]) foreach (line; File(filename).byLine)

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Chris Wright via Digitalmars-d
Add a `writeln(l);` after the call to formattedRead().

Re: Interior pointers and fast GC

2017-01-22 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 06:44:47 +, Araq wrote: > On Sunday, 22 January 2017 at 06:28:35 UTC, Chris Wright wrote: >> On Sun, 22 Jan 2017 05:02:43 +, Araq wrote: >>> It's an O(1) that requires a hash table lookup in general because >>> allocations can exceed the chunk size and so you cannot jus

Re: D for scripting?

2017-01-22 Thread Dicebot via Digitalmars-d
On Sunday, 22 January 2017 at 12:45:26 UTC, Russel Winder wrote: The "problem" here is the role of the D Tools repository. Is it solely for DMD, or is it supposed to be something that can be packaged independent of a particular D compiler. As it is I am not sure it can be the unit of packaging.

Re: D for scripting?

2017-01-22 Thread Dicebot via Digitalmars-d
On Sunday, 22 January 2017 at 13:24:48 UTC, Andrei Alexandrescu wrote: It's also the simplest to solve. Should be Boost. Please create a PR copying the Boost license (from e.g. Phobos itself) to the tools repo. Thanks. -- Andrei RDMD does have license statement already https://github.com/dlan

Re: D for scripting?

2017-01-22 Thread Andrei Alexandrescu via Digitalmars-d
On 1/22/17 7:45 AM, Russel Winder via Digitalmars-d wrote: On Sat, 2017-01-21 at 11:30 -0500, Andrei Alexandrescu via Digitalmars- d wrote: […] rdmd is a single-file program distributed under a very permissive license. Would you care to repackage it the way you find more appropriate? -- Andrei

Re: @safe containers with std.experimental.allocator

2017-01-22 Thread Andrei Alexandrescu via Digitalmars-d
On 1/21/17 10:07 PM, bitwise wrote: On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei Alexandrescu wrote: Andrei Anyways, design opinions aside, I would be satisfied if an aligned allocator were included in std.allocators that provided aligned heap memory using allocate()/deallocate(). The

Re: D for scripting?

2017-01-22 Thread Laeeth Isharc via Digitalmars-d
On Friday, 20 January 2017 at 03:59:12 UTC, 岩倉 澪 wrote: Is anyone else using D for scripting? Yes! I keep my scripts in ~/scripts so that I can just pull them from github and go on my merry way, with symlinks in /usr/local/bin, but rdmd doesn't -I the real directory, it does -I/usr/local/bi

Re: Interior pointers and fast GC

2017-01-22 Thread deadalnix via Digitalmars-d
On Sunday, 22 January 2017 at 05:02:43 UTC, Araq wrote: It's an O(1) that requires a hash table lookup in general because allocations can exceed the chunk size and so you cannot just mask the pointer and look at the chunk header because it might not be a chunk header at all. Know any production

Re: D for scripting?

2017-01-22 Thread Russel Winder via Digitalmars-d
On Sat, 2017-01-21 at 11:30 -0500, Andrei Alexandrescu via Digitalmars- d wrote: […] > > rdmd is a single-file program distributed under a very permissive  > license. Would you care to repackage it the way you find more  > appropriate? -- Andrei The "problem" here is the role of the D Tools repos

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Stefan Koch via Digitalmars-d
On Sunday, 22 January 2017 at 11:20:18 UTC, Danny Arends wrote: On Sunday, 22 January 2017 at 10:30:14 UTC, Stefan Koch wrote: On Sunday, 22 January 2017 at 10:01:09 UTC, Danny Arends wrote: On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote: Hey all, I encountered some unexpected

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Danny Arends via Digitalmars-d
On Sunday, 22 January 2017 at 10:30:14 UTC, Stefan Koch wrote: On Sunday, 22 January 2017 at 10:01:09 UTC, Danny Arends wrote: On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote: Hey all, I encountered some unexpected behavior in std.format, I was parsing Wavefront obj file, and r

Re: Error deducing function

2017-01-22 Thread Stefan Koch via Digitalmars-d
On Friday, 13 January 2017 at 23:22:22 UTC, Ignacious wrote: On Friday, 13 January 2017 at 22:57:09 UTC, Adam D. Ruppe wrote: On Friday, 13 January 2017 at 22:22:12 UTC, Ignacious wrote: Like, which arguments actually pass and which ones fail, etc. Yes, I agree entirely. This would be a HUGE

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Stefan Koch via Digitalmars-d
On Sunday, 22 January 2017 at 10:01:09 UTC, Danny Arends wrote: On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote: Hey all, I encountered some unexpected behavior in std.format, I was parsing Wavefront obj file, and ran into an issue. I updated the compiler to the latest stable v

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Danny Arends via Digitalmars-d
On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote: Hey all, I encountered some unexpected behavior in std.format, I was parsing Wavefront obj file, and ran into an issue. I updated the compiler to the latest stable version (// DMD64 D Compiler v2.072.2), however I think it's a Ph

Re: Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Daniel N via Digitalmars-d
On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote: Hey all, Can anyone confirm this, since it looks like such a weird bug to me ? Kind regards, Danny Arends The ASCII code for / is 47.

Possible bug in skipOver() from std/algorithm/searching.d

2017-01-22 Thread Danny Arends via Digitalmars-d
Hey all, I encountered some unexpected behavior in std.format, I was parsing Wavefront obj file, and ran into an issue. I updated the compiler to the latest stable version (// DMD64 D Compiler v2.072.2), however I think it's a Phobos related issue. Given the following code: test.d