Re: surviving wasm

2023-12-13 Thread monkyyy via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 21:15:47 UTC, Julian Fondren wrote: 6. statically build against musl and include it in the wasm binary. Since phobos is slow to change, its libc dependencies will also be slow to change, and you can work on reducing how much musl goes into the binary. Musl's

Re: surviving wasm

2023-12-13 Thread Julian Fondren via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 20:40:20 UTC, monkyyy wrote: so long term planning on wasm raylib; I want compatibility with the good parts of the std, the std is causal about using libc while ldc-wasm half-baked implication is missing a bunch of basically worthless symbols but given the std

Re: Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread Siarhei Siamashka via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 19:51:11 UTC, Adam D Ruppe wrote: On Wednesday, 13 December 2023 at 19:37:09 UTC, Siarhei Siamashka wrote: Now I'm curious. Is it possible to somehow communicate the real source file name to `dmd`, so that it shows up in the error log instead of "__stdin.d"?

surviving wasm

2023-12-13 Thread monkyyy via Digitalmars-d-learn
so long term planning on wasm raylib; I want compatibility with the good parts of the std, the std is causal about using libc while ldc-wasm half-baked implication is missing a bunch of basically worthless symbols but given the std is 1 million lines of code it will be a perennial problem that

Re: Permutations of array (slice) ?

2023-12-13 Thread Nick Treleaven via Digitalmars-d-learn
On Tuesday, 12 December 2023 at 16:21:46 UTC, Kevin Bailey wrote: On Tuesday, 12 December 2023 at 15:20:23 UTC, Paul Backus wrote: But unfortunately, the code shown now prints 120 lines of: b 120 being suspiciously equal to 5!. The documentation[2] seems to imply that this should be: baa

Re: Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Dec 13, 2023 at 11:58:42AM -0800, H. S. Teoh via Digitalmars-d-learn wrote: [...] > Add a module declaration to your source file. For example: > > echo 'module abc; import std; void main(){writefln(__MODULE__);}' | dmd > -run - > > Output: > abc > > `__stdin` is used as a p

Re: Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Dec 13, 2023 at 07:37:09PM +, Siarhei Siamashka via Digitalmars-d-learn wrote: > Example: > > ```D > import std; > void main() { > deliberate syntax error here > } > ``` > > ```bash > $ cat example.d | dmd -run - > __stdin.d(3): Error: found `error` when expecting `;` or `=`, did y

Re: Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 19:37:09 UTC, Siarhei Siamashka wrote: Now I'm curious. Is it possible to somehow communicate the real source file name to `dmd`, so that it shows up in the error log instead of "__stdin.d"? the sequence `#line "filename.d" 1` at the top of the thing might do

Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread Siarhei Siamashka via Digitalmars-d-learn
Example: ```D import std; void main() { deliberate syntax error here } ``` ```bash $ cat example.d | dmd -run - __stdin.d(3): Error: found `error` when expecting `;` or `=`, did you mean `deliberate syntax = here`? __stdin.d(3): Error: found `}` when expecting `;` or `=`, did you mean `error

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: macOS Sonoma Linker Issue

2023-12-13 Thread Renato via Digitalmars-d-learn
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote: On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote: Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've

Re: question

2023-12-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 12:49:14 UTC, fred wrote: a bug ? It helps if you explain what you're talking about so we don't have to guess. I tried the code on my computer and it worked fine. But then figuring, you must be saying something doesn't work right, I tried it on another com

Re: question

2023-12-13 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 12:49:14 UTC, fred wrote: [...] a bug ? thanks anyway Try to define the flag as static ```d static shared(bool) isDone = false; ``` I dont know if that should be a compiler error to have local shared (I tend to think yes as locals are specific to a frame, i

question

2023-12-13 Thread fred via Digitalmars-d-learn
import core.thread; import std.concurrency; import std.stdio : w = writeln; void w2(shared(bool) *done) { while (*done == false) { Thread.sleep(100.msecs); w("print done? ", *done); } } void s2() { shared(bool) i