Re: TIL: writing to a socket and dying

2025-04-25 Thread Andy Valencia via Digitalmars-d-learn
On Thursday, 24 April 2025 at 19:36:03 UTC, kdevel wrote: Phobos appears to try and inhibit this on some BSD systems, How does it do that? Sorry, I forgot to answer this question. There's a setsockopt SO_NOSIGPIPE which is used if available during initial socket setup (in Phobos). Some com

Re: TIL: writing to a socket and dying

2025-04-24 Thread Andy Valencia via Digitalmars-d-learn
On Thursday, 24 April 2025 at 19:36:03 UTC, kdevel wrote: [...] I added a SIG_IGN of SIGPIPE and that made the problem stop. You know that it will now throw? [0] Yes; my server was written to handle an exception, and it also is prepared for the send() to return failure. Adding a third vecto

Re: TIL: writing to a socket and dying

2025-04-24 Thread kdevel via Digitalmars-d-learn
f the signal is to notify [the process writing to the closed socket] asynchronously that the write is no longer possible. This is part of what makes the whole elegant co-routine structure of pipes work in UNIX." [1] The truth is probably that there are lots of programs which don't

Re: TIL: writing to a socket and dying

2025-04-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 25/04/2025 2:04 AM, Andy Valencia wrote: This has been touched upon way back in forum history, but I thought it was worth a fresh mention.  When writing to a socket--especially as a server--you can receive SIGPIPE.  Phobos appears to try and inhibit this on some BSD systems, but on Linux if

TIL: writing to a socket and dying

2025-04-24 Thread Andy Valencia via Digitalmars-d-learn
This has been touched upon way back in forum history, but I thought it was worth a fresh mention. When writing to a socket--especially as a server--you can receive SIGPIPE. Phobos appears to try and inhibit this on some BSD systems, but on Linux if the recipient has closed the socket and you

Re: Writing your own runtime, runtime hooks, etc.

2024-12-12 Thread Kagamin via Digitalmars-d-learn
On Thursday, 12 December 2024 at 15:56:55 UTC, H. S. Teoh wrote: It's not quite so simple in practice, though. You also need to know exactly which symbols need to be defined in order for the custom runtime to actually work. Some of these symbols are non-obvious, but missing them will cause th

Re: Writing your own runtime, runtime hooks, etc.

2024-12-12 Thread solidstate1991 via Digitalmars-d-learn
On Thursday, 12 December 2024 at 15:56:55 UTC, H. S. Teoh wrote: It's not quite so simple in practice, though. You also need to know exactly which symbols need to be defined in order for the custom runtime to actually work. Some of these symbols are non-obvious, but missing them will cause

Re: Writing your own runtime, runtime hooks, etc.

2024-12-12 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Dec 12, 2024 at 06:52:27AM +, GrimMaple via Digitalmars-d-learn wrote: > On Wednesday, 11 December 2024 at 18:16:24 UTC, solidstate1991 wrote: > > I'm thinking about writing, or well, rather modifying the existing > > default runtime of D, mainly by stripping o

Re: Writing your own runtime, runtime hooks, etc.

2024-12-12 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 11 December 2024 at 18:16:24 UTC, solidstate1991 wrote: I will try to catalogue the runtime hooks too during my process, however I don't really see any info about how to use a custom made runtime. Just link programs with your runtime instead of druntime.

Re: Writing your own runtime, runtime hooks, etc.

2024-12-11 Thread GrimMaple via Digitalmars-d-learn
On Wednesday, 11 December 2024 at 18:16:24 UTC, solidstate1991 wrote: I'm thinking about writing, or well, rather modifying the existing default runtime of D, mainly by stripping out the GC and moving memory management to a primarily manual one. Option for refcounting etc. will be

Writing your own runtime, runtime hooks, etc.

2024-12-11 Thread solidstate1991 via Digitalmars-d-learn
I'm thinking about writing, or well, rather modifying the existing default runtime of D, mainly by stripping out the GC and moving memory management to a primarily manual one. Option for refcounting etc. will be added (especially as it exists in Phobos, I just need to modify it), rework

Re: Safer binary reading (or writing) code

2023-12-13 Thread cc via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 09:43:39 UTC, Joel wrote: I've got this mixin thing, I think it's less typo-prone. I haven't been able to make it show the variable's name, though. Also, it should be optional whether it prints anything, (it's not hard for me to do that though). ```d // mixin(j

Re: Safer binary reading (or writing) code

2023-12-12 Thread Joel via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 09:43:39 UTC, Joel wrote: I've got this mixin thing, I think it's less typo-prone. I haven't been able to make it show the variable's name, though. Also, it should be optional whether it prints anything, (it's not hard for me to do that though). ```d // mixin(j

Safer binary reading (or writing) code

2023-12-12 Thread Joel via Digitalmars-d-learn
I've got this mixin thing, I think it's less typo-prone. I haven't been able to make it show the variable's name, though. Also, it should be optional whether it prints anything, (it's not hard for me to do that though). ```d // mixin(jread("width")); -> fread(&width, 1, width.sizeof, bfile);

Re: Writing a simple text editor in D using a C tutorial

2023-08-29 Thread Răzvan Birișan via Digitalmars-d-learn
On Tuesday, 29 August 2023 at 16:59:57 UTC, Dejan Lekic wrote: On Tuesday, 29 August 2023 at 16:17:56 UTC, Răzvan Birișan wrote: Is there a better way to use `termios.h` inside D? Am I missing the point and there is a way to set these flags in D without using C libraries? I would try to use t

Re: Writing a simple text editor in D using a C tutorial

2023-08-29 Thread Dejan Lekic via Digitalmars-d-learn
On Tuesday, 29 August 2023 at 16:17:56 UTC, Răzvan Birișan wrote: Is there a better way to use `termios.h` inside D? Am I missing the point and there is a way to set these flags in D without using C libraries? I would try to use termios from druntime instead. Try: import core.sys.posix.termio

Writing a simple text editor in D using a C tutorial

2023-08-29 Thread Răzvan Birișan via Digitalmars-d-learn
Hello, I'm following this [tutorial](https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode.html#disable-ctrl-s-and-ctrl-q) and I'm having some trouble setting the flags. I have this C program that works properly (exits as soon as I press `q` and `CTRL+C` does not kill it). ``` #inclu

Re: Writing a dejargoniser - producing read ke analysis output in English that explains GDC / LDC asm code’s parameters and clobbers

2023-04-05 Thread z via Digitalmars-d-learn
On Wednesday, 5 April 2023 at 15:19:55 UTC, Cecil Ward wrote: How much code do you thing I would need to write for this? I’m still thinking about its feasibility. I don’t want to invent the wheel and write a custom parser by hand, so’d rather steal the code using sim eg called ‘a library’. :-)

Writing a dejargoniser - producing read ke analysis output in English that explains GDC / LDC asm code’s parameters and clobbers

2023-04-05 Thread Cecil Ward via Digitalmars-d-learn
How much code do you thing I would need to write for this? I’m still thinking about its feasibility. I don’t want to invent the wheel and write a custom parser by hand, so’d rather steal the code using sim eg called ‘a library’. :-) The idea would be that the user could run this to sanity-chec

Re: Windows Console and writing Unicode characters

2021-03-30 Thread Luhrel via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 13:19:02 UTC, Adam D. Ruppe wrote: On Tuesday, 30 March 2021 at 08:31:02 UTC, Luhrel wrote: I have been used this trick in C++, so it might also work in D: If you follow through the link that's what I mention as being a bad idea and provide the code given as a mor

Re: Windows Console and writing Unicode characters

2021-03-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 08:31:02 UTC, Luhrel wrote: I have been used this trick in C++, so it might also work in D: If you follow through the link that's what I mention as being a bad idea and provide the code given as a more correct alternative. It changes a global (well to the console

Re: Windows Console and writing Unicode characters

2021-03-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 08:31:02 UTC, Luhrel wrote: I have been used this trick in C++, so it might also work in D: ``` import core.stdc.stdlib; import std.stdio; void main() { version(Windows) system("chcp 65001 > NUL".ptr); writeln("çéäö"); } ``` Works like a charm in

Re: Windows Console and writing Unicode characters

2021-03-30 Thread Luhrel via Digitalmars-d-learn
On Monday, 29 March 2021 at 02:12:57 UTC, Brad wrote: I am new here so I will post this in Learn. I have been doing a bit of reading on printing unicode characters in the Windows Console. Specifically W10 command prompt. I ran across a post by Adam Ruppe in a thread created a couple years a

Re: Windows Console and writing Unicode characters

2021-03-29 Thread Brad via Digitalmars-d-learn
On Monday, 29 March 2021 at 11:53:32 UTC, Adam D. Ruppe wrote: On Monday, 29 March 2021 at 02:12:57 UTC, Brad wrote: [...] You can still import std.stdio and use other functions with just the one overridden. D handles name lookups by just ... well, looking up lol. It starts in the current

Re: Windows Console and writing Unicode characters

2021-03-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 29 March 2021 at 02:12:57 UTC, Brad wrote: a custom implementation for writeln rather than use the one in stdout module (package?) that would mean any other functions from that package I would want to leverage I would need to include by name. You can still import std.stdio and use

Windows Console and writing Unicode characters

2021-03-28 Thread Brad via Digitalmars-d-learn
I am new here so I will post this in Learn. I have been doing a bit of reading on printing unicode characters in the Windows Console. Specifically W10 command prompt. I ran across a post by Adam Ruppe in a thread created a couple years ago which links a short bit of code and a quick discussi

Re: Writing a really fast lexer

2020-12-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 12 December 2020 at 18:15:11 UTC, vnr wrote: Yes, I know Pegged, it's a really interesting parser generator engine, nevertheless, the grammar of what I would like to analyse is not a PEG. But I am also curious to know the performances of this tool for very large inputs. The perfo

Re: Writing a really fast lexer

2020-12-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 12 December 2020 at 18:15:11 UTC, vnr wrote: On Saturday, 12 December 2020 at 16:43:43 UTC, Bastiaan Veelo wrote: Have you looked at Pegged [1]? It will give you the lexer and parser in one go. I'd be very interested to see how it performs on that kind of input. -- Bastiaan. [1]

Re: Writing a really fast lexer

2020-12-12 Thread vnr via Digitalmars-d-learn
stream of tokens. I started writing a lexer with the d-lex package (https://code.dlang.org/packages/d-lex), it works really well, unfortunately, it's quite slow for the number of lines I'm aiming to analyse (I did a test, for a million lines, it lasted about 3 minutes). As the parser

Re: Writing a really fast lexer

2020-12-12 Thread vnr via Digitalmars-d-learn
On Friday, 11 December 2020 at 20:19:49 UTC, H. S. Teoh wrote: On Fri, Dec 11, 2020 at 07:49:12PM +, vnr via Digitalmars-d-learn wrote: [...] If you want a *really* fast lexer, I recommend using GNU Flex (https://github.com/westes/flex/). Unfortunately, AFAIK it does not support D direc

Re: Writing a really fast lexer

2020-12-12 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 11 December 2020 at 19:49:12 UTC, vnr wrote: For a project with good performance, I would need to be able to analyse text. To do so, I would write a parser by hand using the recursive descent algorithm, based on a stream of tokens. I started writing a lexer with the d-lex package

Re: Writing a really fast lexer

2020-12-11 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Dec 11, 2020 at 07:49:12PM +, vnr via Digitalmars-d-learn wrote: > For a project with good performance, I would need to be able to > analyse text. To do so, I would write a parser by hand using the > recursive descent algorithm, based on a stream of tokens. I started > wri

Writing a really fast lexer

2020-12-11 Thread vnr via Digitalmars-d-learn
For a project with good performance, I would need to be able to analyse text. To do so, I would write a parser by hand using the recursive descent algorithm, based on a stream of tokens. I started writing a lexer with the d-lex package (https://code.dlang.org/packages/d-lex), it works really

Re: iopipe: Writing output to std.io File

2020-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/20 12:59 AM, Jesse Phillips wrote: On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer wrote: Everything is pulled with iopipe, even output, so it's just a matter of who is pulling and when. Pushing is a matter of telling the other end to pull. That statement I think

Re: iopipe: Writing output to std.io File

2020-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer wrote: Everything is pulled with iopipe, even output, so it's just a matter of who is pulling and when. Pushing is a matter of telling the other end to pull. -Steve That statement I think will be very helpful to me. The pus

Re: iopipe: Writing output to std.io File

2020-01-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/28/20 1:25 AM, Jesse Phillips wrote: I really feel like this is all very well thought out and clean, I don't appear to have a previous model to help visualize this output approach. Right now something like tee is coming to mind. Thank you for explaining with the answer. Thanks! Tee is a

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Jesse Phillips via Digitalmars-d-learn
buffer, this basically is just a cast. Other encodings might do byteswapping. But you have done this step a bit early. At this point now, the window type is ubyte[]. You want to put data into the buffer as char[]. 3. You appended an outputPipe, which is a pass through while writing the data to a

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/27/20 1:12 PM, Steven Schveighoffer wrote: void writeln(Pipe)(ref Pipe sink, string text) {    enforce(sink.ensureElems(text.size) >= text.length); // make sure there's enough buffer space to hold the text    sink[0 .. text.length] = text; // write to the buffer    sink.release(text.le

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Steven Schveighoffer via Digitalmars-d-learn
d differently from input. With output you are writing to the buffer, then flushing the result as needed. But I constructed iopipe to be able to utilize all mechanisms as both input and output. Before I show you what to do, let me explain what the above actually does. 1. You constructed a buffe

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote: Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang auto output() { return std.io.File("somefile.txt", mode!"w").refC

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang /+ dub.sdl: name "iobuftofile" dependency "iopipe" version="~>0.1.7" dependency "io" version="~>0.2.4" +/ void main() { import

iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
I'd like to start utilizing IOPipe[1] more. Right now I have an interest in utilizing it for buffering output (actually I don't have a need for buffering, I just want to utilize iopipe) Looking through some different examples[2][3] I thought I would have something with this: ```dlang /+ dub.

Re: Segfault when writing to module-scope dynamic array

2019-11-18 Thread rombankzero via Digitalmars-d-learn
On Monday, 18 November 2019 at 13:28:26 UTC, Adam D. Ruppe wrote: But it is rare and if you aren't specifically looking for it knowing the details, it isn't right. And since the syntax looks so normal it trips up a LOT of people. I think the compiler should probably start to error on it, and

Re: Segfault when writing to module-scope dynamic array

2019-11-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 November 2019 at 13:22:20 UTC, rombankzero wrote: Yeah, that appears to be what's happening. For the record, I tried it on both Linux and Windows, and only got a segfault on Linux. Yeah, that's consistent with other strings too. (The D type system calls both immutable, but the O

Re: Segfault when writing to module-scope dynamic array

2019-11-18 Thread rombankzero via Digitalmars-d-learn
On Monday, 18 November 2019 at 12:42:26 UTC, Adam D. Ruppe wrote: My guess is the compiler is seeing a static string and incorrectly putting it in the read-only segment with the other strings, and then writing to it thus triggers that segfault. Yeah, that appears to be what's happening

Re: Segfault when writing to module-scope dynamic array

2019-11-18 Thread Adam D. Ruppe via Digitalmars-d-learn
it in the read-only segment with the other strings, and then writing to it thus triggers that segfault. just a guess, and if correct, this is a dmd bug. But I'd still recommend doing the `new` inside a function/module constructor anyway. That takes the static aspect out entirely and pre

Segfault when writing to module-scope dynamic array

2019-11-18 Thread rombankzero via Digitalmars-d-learn
Hi! Can anybody explain why this snippet segfaults when I try to run it: char[] array = new char[5]; void main() { array[0] = 'a'; } It works fine if I move the array into main, or (strangely) if I change its type to ubyte[] instead of char[], or if I merely read the array without modi

Re: Writing Program Without main Function

2018-12-08 Thread Samir via Digitalmars-d-learn
On Saturday, 8 December 2018 at 03:30:30 UTC, Jonathan M Davis wrote: There's one main per program, not per module. Where main lives depends on how the program was written, but dub encourages putting it in app.d, because that's what it generates when you create a new dub project. imports then p

Re: Writing Program Without main Function

2018-12-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 7, 2018 2:42:33 PM MST Samir via Digitalmars-d-learn wrote: > Ok. Upon further investigation, I think I see what is going on. > Most of the repos I am skimming are for this year's Advent of > Code. They structure their repo with an `app.d` file which does > contain a `main` f

Re: Writing Program Without main Function

2018-12-07 Thread Samir via Digitalmars-d-learn
Ok. Upon further investigation, I think I see what is going on. Most of the repos I am skimming are for this year's Advent of Code. They structure their repo with an `app.d` file which does contain a `main` function but this program is structured such that it imports the files I was looking

Re: Writing Program Without main Function

2018-12-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 7, 2018 2:02:59 PM MST Samir via Digitalmars-d-learn wrote: > Is it possible to write and execute a D program without a main > function? > > Most of my programs will start with some `import` statements, > followed by any functions and then ending with the `main` > function (e.g

Re: Writing Program Without main Function

2018-12-07 Thread rikki cattermole via Digitalmars-d-learn
There is always a main function. It doesn't matter in which module its in or language. It just has to exist.

Writing Program Without main Function

2018-12-07 Thread Samir via Digitalmars-d-learn
Is it possible to write and execute a D program without a main function? Most of my programs will start with some `import` statements, followed by any functions and then ending with the `main` function (e.g. `void main() {`). As I am just a beginner to programming and still new to D, I have

Re: Writing Postgresql extension in D

2018-11-16 Thread Bienlein via Digitalmars-d-learn
On Friday, 16 November 2018 at 02:18:11 UTC, Ranjan wrote: On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana wrote: On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote: This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want

Re: Writing Postgresql extension in D

2018-11-15 Thread Radu via Digitalmars-d-learn
On Friday, 16 November 2018 at 02:18:11 UTC, Ranjan wrote: On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana wrote: On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote: This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want

Re: Writing Postgresql extension in D

2018-11-15 Thread rikki cattermole via Digitalmars-d-learn
On 16/11/2018 3:18 PM, Ranjan wrote: On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana wrote: On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote: This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want to write Postgresql ex

Re: Writing Postgresql extension in D

2018-11-15 Thread Ranjan via Digitalmars-d-learn
On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana wrote: On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote: This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want to write Postgresql extension in D. Currently extension can

Re: Writing Postgresql extension in D

2018-11-15 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote: This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want to write Postgresql extension in D. Currently extension can be written in C or C linked languages. Has anyone done this or can p

Writing Postgresql extension in D

2018-11-15 Thread Ranjan via Digitalmars-d-learn
This is my first time on the Dlang forum. I like the language but my usecase is a bit different. I want to write Postgresql extension in D. Currently extension can be written in C or C linked languages. Has anyone done this or can point me to some code. Thanks

Re: Preffered way of writing variadic templated functions in 2.079

2018-03-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, March 08, 2018 08:36:09 Nordlöw via Digitalmars-d-learn wrote: > Is using > > https://dlang.org/changelog/2.079.0.html#default_after_variadic > > for instance as > > void show(Args...)(Args args, > string file = __FILE__, > uint line = __LINE__,

Preffered way of writing variadic templated functions in 2.079

2018-03-08 Thread Nordlöw via Digitalmars-d-learn
Is using https://dlang.org/changelog/2.079.0.html#default_after_variadic for instance as void show(Args...)(Args args, string file = __FILE__, uint line = __LINE__, string fun = __FUNCTION__) if (Args.length >= 1) { ... } preferr

Re: Any book recommendation for writing a compiler?

2017-11-09 Thread Jim Hewes via Digitalmars-d-learn
Thanks for those references! I'm also interested in looking through those. I had computation theory in college a long time ago but never took a compiler course. On 11/7/2017 5:26 AM, Tony wrote: Author Allen Holub has made his out-of-print book, Compiler Design in C, available as a free pdf

Re: Any book recommendation for writing a compiler?

2017-11-07 Thread Tony via Digitalmars-d-learn
Author Allen Holub has made his out-of-print book, Compiler Design in C, available as a free pdf download: http://holub.com/compiler/ And Torben Mogensen is doing the same with his more recent Basics of Compiler Design: http://www.diku.dk/~torbenm/Basics/

Re: Any book recommendation for writing a compiler?

2017-11-07 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 7 November 2017 at 01:30:14 UTC, Basile B. wrote: On Saturday, 4 November 2017 at 20:28:17 UTC, Ola Fosheim Grøstad wrote: On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language

Re: Any book recommendation for writing a compiler?

2017-11-06 Thread Basile B. via Digitalmars-d-learn
On Saturday, 4 November 2017 at 20:28:17 UTC, Ola Fosheim Grøstad wrote: On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own progr

Re: Any book recommendation for writing a compiler?

2017-11-04 Thread Eugene Wissner via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? A few more resources on writing a frontend (lexer, synt

Re: Any book recommendation for writing a compiler?

2017-11-04 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Saturday, 4 November 2017 at 15:51:30 UTC, Basile B. wrote: People who say that after reading the dragon book, you will program your own programming language are lying. Well, you most certainly can write your own programming language after reading about 30% of the dragon book, but I think y

Re: Any book recommendation for writing a compiler?

2017-11-04 Thread Basile B. via Digitalmars-d-learn
On Thursday, 2 November 2017 at 14:24:01 UTC, Basile B. wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out?

Re: Any book recommendation for writing a compiler?

2017-11-02 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? You don't need to read books to write a compiler, a bit of th

Re: Any book recommendation for writing a compiler?

2017-11-02 Thread Igor via Digitalmars-d-learn
On Thursday, 2 November 2017 at 03:55:27 UTC, Michael V. Franklin wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I found this to be quite helpful: http://llvm.org/docs/tutori

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread rikki cattermole via Digitalmars-d-learn
On 01/11/2017 11:13 PM, Jonathan M Davis wrote: On Wednesday, November 01, 2017 20:53:44 Dr. Assembly via Digitalmars-d- learn wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start o

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Alexandre via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:56:22 UTC, Dr. Assembly wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 01, 2017 20:53:44 Dr. Assembly via Digitalmars-d- learn wrote: > Hey guys, if I were to get into dmd's source code to play a > little bit (just for fun, no commercial use at all), which > books/resources do you recommend to start out? Well, if you're looking to actually buy

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Ali Çehreli via Digitalmars-d-learn
On 11/01/2017 01:53 PM, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I haven't read it but one compiler bible is "the dragon book": https://www.amazon.

Re: Any book recommendation for writing a compiler?

2017-11-01 Thread Dr. Assembly via Digitalmars-d-learn
On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out? I'd like something on back-end too, for example, code generat

Any book recommendation for writing a compiler?

2017-11-01 Thread Dr. Assembly via Digitalmars-d-learn
Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to start out?

Re: Writing some built-in functions for Bash, possible?

2017-10-21 Thread Ky-Anh Huynh via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 08:15:53 UTC, evilrat wrote: [...] This isn't the actual code but should give you a hint, the rest is up to you. Woh Thanks a ton. I can have some working code after a few hours :D https://github.com/icy/dusybox/blob/master/lib/dusybox/bash_builtin_hello/pa

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 08:22:09 UTC, Andrea Fontana wrote: On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote: You can write your script in D using #!/usr/local/bin/rdmd as shebang line. Or, using dstep, you can convert C headers to D imports, so you can compile your

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote: Hi, I'm using Bash heavily in my systems. Things become slow and slow when I have tons of scripts :) And sometimes it's not easy to manipulate data. You may have heard of recutils [1] which has a C extension to be loaded by

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 08:15:53 UTC, evilrat wrote: ... extern(C) static int test_builtin(WORD_LIST* list) ... This of course should be nothrow also, because if it throws something really bad may(will) happen

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote: Hi, I'm using Bash heavily in my systems. Things become slow and slow when I have tons of scripts :) And sometimes it's not easy to manipulate data. You may have heard of recutils [1] which has a C extension to be loaded by

Re: Writing some built-in functions for Bash, possible?

2017-10-17 Thread Ky-Anh Huynh via Digitalmars-d-learn
ngs) scripts. And yeah writing in Bash has a lot of side effects ^.^

Writing some built-in functions for Bash, possible?

2017-10-17 Thread Ky-Anh Huynh via Digitalmars-d-learn
Hi, I'm using Bash heavily in my systems. Things become slow and slow when I have tons of scripts :) And sometimes it's not easy to manipulate data. You may have heard of recutils [1] which has a C extension to be loaded by Bash. Is it possible to write similar things in D, for Bash? I am n

Re: Does writing from NNTP work?

2017-10-04 Thread Tristan B. Kildaire via Digitalmars-d-learn
On 2017/10/04 21:20, Jonathan M Davis wrote: On Wednesday, October 04, 2017 17:26:36 ketmar via Digitalmars-d-learn wrote: Tristan B. Kildaire wrote: Does this work? btw. there is "D" newsgroup which you can use for testing your NNTP client. web interface: http://forum.dlang.org/group/D NNTP

Re: Does writing from NNTP work?

2017-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 04, 2017 17:26:36 ketmar via Digitalmars-d-learn wrote: > Tristan B. Kildaire wrote: > > Does this work? > > btw. there is "D" newsgroup which you can use for testing your NNTP > client. > > web interface: http://forum.dlang.org/group/D > NNTP name: "D" You can also just pos

Re: Does writing from NNTP work?

2017-10-04 Thread Tristan B. Kildaire via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 14:26:36 UTC, ketmar wrote: Tristan B. Kildaire wrote: Does this work? btw. there is "D" newsgroup which you can use for testing your NNTP client. web interface: http://forum.dlang.org/group/D NNTP name: "D" Ah okay. Thanks.

Re: Does writing from NNTP work?

2017-10-04 Thread ketmar via Digitalmars-d-learn
Tristan B. Kildaire wrote: Does this work? btw. there is "D" newsgroup which you can use for testing your NNTP client. web interface: http://forum.dlang.org/group/D NNTP name: "D"

Re: Does writing from NNTP work?

2017-10-04 Thread Tristan B. Kildaire via Digitalmars-d-learn
On 2017/10/04 16:20, Andrea Fontana wrote: On Wednesday, 4 October 2017 at 14:18:52 UTC, Tristan B. Kildaire wrote: Does this work? No, I don't read you. Try again :) Haha, thanks. :)

Re: Does writing from NNTP work?

2017-10-04 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 14:18:52 UTC, Tristan B. Kildaire wrote: Does this work? No, I don't read you. Try again :)

Re: Does writing from NNTP work?

2017-10-04 Thread ketmar via Digitalmars-d-learn
Tristan B. Kildaire wrote: Does this work? if you can see this reply, it works.

Re: Does writing from NNTP work?

2017-10-04 Thread Tristan B. Kildaire via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 14:18:52 UTC, Tristan B. Kildaire wrote: Does this work? Sorry about this guys, just wanted to check out if NNTP access worked on my side. Won't happen again.

Does writing from NNTP work?

2017-10-04 Thread Tristan B. Kildaire via Digitalmars-d-learn
Does this work?

Re: This used to compile for months and months, and now it aborts with Error writing file derelict-assimp3-1.3.0

2017-09-26 Thread Adam D. Ruppe via Digitalmars-d-learn
error writing to file on windows is typically caused by the file being in use by another program. Are you running another copy of it at the same time maybe?

This used to compile for months and months, and now it aborts with Error writing file derelict-assimp3-1.3.0

2017-09-26 Thread WhatMeWorry via Digitalmars-d-learn
..\..\..\..\..\AppData\Roaming\dub\packages\derelict-assimp3-1.3.0\derelict-assimp3\source\derelict\assimp3\types.d -vcolumns Error: Error writing file '..\..\..\..\..\AppData\Roaming\dub\packages\derelict-assimp3-1.3.0\derelict-assimp3\.dub\build\library-$DFLAGS-windows-x86_64-dm

Re: Automatic function body writing howto?

2017-08-17 Thread Oleg B via Digitalmars-d-learn
On Wednesday, 16 August 2017 at 22:48:59 UTC, Meta wrote: It's hard to tell offhand but I would recommend that you extract the inner string into a function that generates that string, allowing you to print out the finished product before mixing it in. It's have a same result...

Re: Automatic function body writing howto?

2017-08-16 Thread Meta via Digitalmars-d-learn
It's hard to tell offhand but I would recommend that you extract the inner string into a function that generates that string, allowing you to print out the finished product before mixing it in.

Automatic function body writing howto?

2017-08-16 Thread Oleg B via Digitalmars-d-learn
I want declare only signature of function and build body code by CTFE. module mdl; import std.stdio; import std.traits; import std.string; enum autofnc; @autofnc { int foo(int); int bar(int); } void main() { writeln(foo(12)); } mixin cfuncR; mixin template cfuncR() {

Re: Idiomatic way of writing nested loops?

2017-07-18 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-07-18 at 08:41 +, Anton Fediushin via Digitalmars-d-learn wrote: > On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote: > > With regards to parallel, only use it on the outermost loop. > > Assuming you have more items in the outermost loop than you do > > threads para

Re: Idiomatic way of writing nested loops?

2017-07-18 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-07-18 at 03:36 +, Nicholas Wilson via Digitalmars-d-learn wrote: > On Monday, 17 July 2017 at 11:07:35 UTC, Anton Fediushin wrote: > > […] > > > > Also, I have a question about running this in parallel: if I > > want to use nested loops with `parallel` from > > `std.parallelism`

  1   2   3   >