how to use dmd.lexer.Lexer

2023-01-06 Thread jonatjano via Digitalmars-d-learn
Hello, I'm trying to write a script which parse a c header and then ouput basic bindings for multiple languages. I read from the forum some times ago that the D compiler could be used as a library and found [the lexer page in the documentation](https://dlang.org/library/dmd/lexer/lexer.html)

Re: Is there a way to enforce UFCS?

2023-01-06 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 5 January 2023 at 23:05:17 UTC, thebluepandabear wrote: them or remove them. I agree, forbidding function call syntax would be a great usecase for `@property`. It will probably never get implemented though. In older versions, it worked when printing values ​​with writeln. But

Re: Is there a way to enforce UFCS?

2023-01-06 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 6 January 2023 at 15:31:09 UTC, Salih Dincer wrote: If you don't want to get the above output you should use the previous example. But don't forget to connect alias and opCall. For example, you can use @property in version 2.0.83 without all the fanfare. I forgot one thing: if yo

Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
Consider: ``` import std.range.iota; auto r = iota(5, 0); ``` `r` is an empty range, as it should be. But if you call: ``` auto r = iota(5.0, 0); ``` then you get an exception (incorrect startup parameters). This was unexpected, and a pain to debug. What is the rationale behind iota having d

Re: how to use dmd.lexer.Lexer

2023-01-06 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Dmd is a separate code base and is not available in a regular D build. You have to provide it and then link it in. The easiest way to do it is by using dmd-fe via dub. Examples: https://github.com/dlang/dmd/tree/master/compiler/test/dub_package So something like this: ```json { "name"

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Ali Çehreli via Digitalmars-d-learn
On 1/6/23 15:23, Arredondo wrote: > then you get an exception (incorrect startup parameters). Although that difference is a bug, iota does have a special floating point implementation to prevent the accumulation of floating point errors. I mention it as item 4 here: https://www.youtube.com

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Arredondo via Digitalmars-d-learn
On Saturday, 7 January 2023 at 00:52:20 UTC, Ali Çehreli wrote: Although that difference is a bug, iota does have a special floating point implementation to prevent the accumulation of floating point errors. Thank you for this clarification Ali. I appreciate the fact that there is a specializ

Re: Bug or feature? iota has different semantics for integer and float arguments

2023-01-06 Thread Ali Çehreli via Digitalmars-d-learn
On 1/6/23 17:50, Arredondo wrote: > Would anyone volunteer to file a bug report? Me! Me! :) https://issues.dlang.org/show_bug.cgi?id=23604 Ali