Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? It almost never does, it just keeps the option open in case * it needs to throw an exception (like if stdout is closed) * you pass it a

Re: Accuracy of floating point calculations

2019-10-31 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 31, 2019 at 09:52:08AM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > On 2019-10-30 15:12:29 +, H. S. Teoh said: [...] > > Do you mean *simulated* 128-bit reals (e.g. with a pair of 64-bit > > doubles), or do you mean actual IEEE 128-bit reals? > > Simulated, because HW

Documentation: is it intentional that template constraints are displayed after the signature?

2019-10-31 Thread Tobias Pankrath via Digitalmars-d-learn
e.g. here: https://dlang.org/library/object/destroy.html I was confused at first by the trailing if (!is(T == struct) && !is(T == interface) && !is(T == class) && !__traits(isStaticArray, T)); after I somehow managed to completely parse that page without recognizing all other constraints.

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? It almost never does, it just keeps the option open in case * it needs to throw an exception (like if stdout is closed) * you pass it a custom type with toString that uses GC @nogc is just super strict and

Re: Is there any writeln like functions without GC?

2019-10-31 Thread bachmeier via Digitalmars-d-learn
On Thursday, 31 October 2019 at 15:11:42 UTC, Ferhat Kurtulmuş wrote: It would be nice if one reimplement writeln of Phobos by bypassing gc and use a custom nogc exception as described here*? Of course I can imagine that it would be a breaking change in the language and requires so much work

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread Tobias Pankrath via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote: struct S { S*[] children; } because otherwise when you declare the array the compiler has not finished the semantic ana of S. --- struct Test { Test[] t; } --- Works today. Putting pointers into the container (and thus

Re: Accuracy of floating point calculations

2019-10-31 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-31 16:07:07 +, H. S. Teoh said: Maybe you might be interested in this: https://stackoverflow.com/questions/6769881/emulate-double-using-2-floats Thanks, I know the 2nd mentioned paper. Maybe switch to PPC? :-D Well, our customers don't use PPC Laptops ;-)

Re: Is there any writeln like functions without GC?

2019-10-31 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? I cannot answer why it needs GC but something can be implemented like: import core.stdc.stdio; struct Point { int x; int y; } class Person { string name; uint age; } template

Re: Gtkd and libgtksourceview

2019-10-31 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 31 October 2019 at 11:47:41 UTC, Mike Wey wrote: girtod can be found here: https://github.com/gtkd-developers/gir-to-d It's a tool that generates a D Binding from GObject Introspection files, if you use the GTK installer from the gtkd website or msys2 the needed introspection

Re: Help playing sounds using arsd.simpleaudio

2019-10-31 Thread Murilo via Digitalmars-d-learn
On Wednesday, 30 October 2019 at 19:11:00 UTC, Adam D. Ruppe wrote: On Saturday, 26 October 2019 at 19:48:33 UTC, Murilo wrote: I play a sound the program never ends, the terminal continues to run the program and I have to end it manually. Any ideas what could be causing this? I am using it

Re: Gtkd and libgtksourceview

2019-10-31 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 30 October 2019 at 22:26:41 UTC, Mike Wey wrote: --- girtod -i src --use-runtime-linker --use-bind-dir --- Hmmm... I'll need more information, I'm afraid. I Googled, but I'm not finding any instructions for building these DLLs.

Re: Gtkd and libgtksourceview

2019-10-31 Thread Mike Wey via Digitalmars-d-learn
On 31-10-2019 12:16, Ron Tarrant wrote: On Wednesday, 30 October 2019 at 22:26:41 UTC, Mike Wey wrote: --- girtod -i src --use-runtime-linker --use-bind-dir --- Hmmm... I'll need more information, I'm afraid. I Googled, but I'm not finding any instructions for building these DLLs. girtod

Why Dlang use parsing expression grammar (PEG) parser not BNF?

2019-10-31 Thread lili via Digitalmars-d-learn
Hi: I want implementation Lua on D, I find that a PEG parser https://github.com/PhilippeSigaud/Pegged why do not use BNF parser. Is PEG better than BNF?

Re: Accuracy of floating point calculations

2019-10-31 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-10-30 15:12:29 +, H. S. Teoh said: It wasn't a wrong *decision* per se, but a wrong *prediction* of where the industry would be headed. Fair point... Walter was expecting that people would move towards higher precision, but what with SSE2 and other such trends, and the general

Re: Eliding of slice range checking

2019-10-31 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 11:20:59 UTC, Per Nordlöw wrote: Does DMD/LDC avoid range-checking in slice-expressions such as the one in my array-overload of `startsWith` defined as bool startsWith(T)(scope const(T)[] haystack, scope const(T)[] needle) { if

std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread Tobias Pankrath via Digitalmars-d-learn
My Problem: --- (https://run.dlang.io/is/CfLscj) import std.container.array; import std.traits; struct Test { Test[] t; } struct Test2 { Array!Test2 t; } int main() { return FieldTypeTuple!Test.length + FieldTypeTuple!Test2; } --- I've found

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread user1234 via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:29:28 UTC, Tobias Pankrath wrote: My Problem: --- (https://run.dlang.io/is/CfLscj) import std.container.array; import std.traits; struct Test { Test[] t; } struct Test2 { Array!Test2 t; } int main() { return FieldTypeTuple!Test.length +

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread user1234 via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote: On Thursday, 31 October 2019 at 12:29:28 UTC, Tobias Pankrath wrote: [...] Try struct S { S*[] children; } because otherwise when you declare the array the compiler has not finished the semantic ana of S. so S size is not