Re: I want Sublime 3 D auto import !

2020-06-03 Thread Виталий Фадеев via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 20:08:09 UTC, bauss wrote: What happens if you have the same symbol in multiple modules? Ex. two libraries that implement symbols with same name. First module will inserted. Is there a way to be selective? I want it too! :) And what about keyboard shortcut?

Re: What's the best way to find out which exceptions may be thrown ?

2020-06-03 Thread Luis via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: Could you please elaborate why checked exceptions are more annoying? Have like 3 functions : A calls B, B calls C . Imagine that now you need to throw a checked exception on C, that before wasn't necessary. You need to add the

Re: What's the best way to find out which exceptions may be thrown ?

2020-06-03 Thread wjoe via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 13:58:13 UTC, Bienlein wrote: On Wednesday, 27 May 2020 at 11:40:00 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: [...] For me, it's because they require all functions that touch them to either try/catch or include an exception

Re: Making alias of a struct field needs "this".

2020-06-03 Thread realhet via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer wrote: On 6/2/20 10:51 AM, realhet wrote: On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote: On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote: A month ago I discovered that mixinDeclarations can be used for types

Re: I want Sublime 3 D auto import !

2020-06-03 Thread aberba via Digitalmars-d-learn
On Monday, 1 June 2020 at 17:28:16 UTC, Johannes Loher wrote: On Monday, 1 June 2020 at 16:18:44 UTC, Виталий Фадеев wrote: [...] Demanding stuff usually doesn't work in this community. The usual answer is something like this: If you care about this, implement it yourself or pay somebody to

Re: How to make the compile time red color warning ?

2020-06-03 Thread MrSmith via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 11:48:27 UTC, Виталий Фадеев wrote: Use case: I have class for Windows OS. I not implement class for Linux. I want message about it. When code compiled under Linux. You could use `static assert(false, "Message");` to make it an error.

Re: How to make the compile time red color warning ?

2020-06-03 Thread Виталий Фадеев via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 11:56:26 UTC, MrSmith wrote: On Wednesday, 3 June 2020 at 11:48:27 UTC, Виталий Фадеев wrote: Use case: I have class for Windows OS. I not implement class for Linux. I want message about it. When code compiled under Linux. You could use `static assert(false,

Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread drathier via Digitalmars-d-learn
I'm generating some code. Some of the generated types need to be overridden, so I define them manually at the top of the generated file. Then I need to guard against redefining the identifier (type/value/function) later on, in the generated code. I'm currently using `static if

Re: Is there a list of things which are slow to compile?

2020-06-03 Thread drathier via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:36:52 UTC, drathier wrote: Currently at ~1ksloc/s of d input without optimizing anything, which corresponds to 350ksloc/s if measuring by `-vcg-ast` output instead of d source input, while using the same time measurement from before, so the flag doesn't cost

Re: What's the best way to find out which exceptions may be thrown ?

2020-06-03 Thread wjoe via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 07:19:45 UTC, Luis wrote: On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: Could you please elaborate why checked exceptions are more annoying? Have like 3 functions : A calls B, B calls C . [...] I work daily with Java, and it's pretty annoying. That

How to make the compile time red color warning ?

2020-06-03 Thread Виталий Фадеев via Digitalmars-d-learn
Use case: I have class for Windows OS. I not implement class for Linux. I want message about it. When code compiled under Linux. Example: version ( Windows ) { public import ui.sys.windows.event.keyboardevent; } else { pragma( msg, "Unsupported OS" ); } How to make red color message

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote: You can use this template: enum Exists(alias T) = is(typeof(T)); I don't know if there's a faster way bu this technic is used, notatbly in phobos, to workaroud issues of double declaration in `static foreach` enum Exists(alias

Is there a list of things which are slow to compile?

2020-06-03 Thread drathier via Digitalmars-d-learn
I'm wondering if there's a place that lists things which are slower/faster to compile? DMD is pretty famed for compiling quickly, but I'm not seeing particularly high speed at all, and I want to fix that. Currently at ~1ksloc/s of d input without optimizing anything, which corresponds to

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote: I'm generating some code. Some of the generated types need to be overridden, so I define them manually at the top of the generated file. Then I need to guard against redefining the identifier (type/value/function) later on, in the

Re: Making alias of a struct field needs "this".

2020-06-03 Thread realhet via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 10:11:59 UTC, realhet wrote: On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer wrote: On 6/2/20 10:51 AM, realhet wrote: On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote: On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote: mixin("int[",

writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
C:\Users\vaida\Desktop\Associative Array Sorting> rdmd testingGround.d 0. The quick brown fox jumps over the lazy dog nonononoahahahaha Sphinx of black quartz, judge my vow. 2. # How vexingly quick daft zebras jump! 3. # The five boxing wizards jump quickly 4. # Maecenas consectetur risus a

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread ttk via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 18:23:51 UTC, BoQsc wrote: Here you can see ". hahahahahahaha" and "nononono" and even lineNumber is being merged into the same position. Why is this happening and can this be simply resolved? Your string in "line" has a carriage return character at the end,

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/3/20 2:23 PM, BoQsc wrote: C:\Users\vaida\Desktop\Associative Array Sorting> rdmd testingGround.d 0.  The quick brown fox jumps over the lazy dog nonononoahahahaha Sphinx of black quartz, judge my vow. 2. # How vexingly quick daft zebras jump! 3. # The five boxing wizards jump quickly 4. #

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote: On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote: [...] You can use this template: enum Exists(alias T) = is(typeof(T)); I don't know if there's a faster way bu this technic is used, notatbly in phobos, to workaroud

Re: Is there a list of things which are slow to compile?

2020-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 03, 2020 at 09:36:52AM +, drathier via Digitalmars-d-learn wrote: > I'm wondering if there's a place that lists things which are > slower/faster to compile? DMD is pretty famed for compiling quickly, > but I'm not seeing particularly high speed at all, and I want to fix > that.

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 13:24:17 UTC, Basile B. wrote: This is because the template parameter must be resolved to a valid symbol or type. This version other version bypass the problem: --- enum Exists(string s) = is(typeof(mixin(s))); void main() { static if (!Exists!"foo")

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 10:24:44 UTC, Simen Kjærås wrote: On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote: You can use this template: enum Exists(alias T) = is(typeof(T)); I don't know if there's a faster way bu this technic is used, notatbly in phobos, to workaroud issues

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this is only initial proof. Improved example with the above comments resolved. testingGround.d import

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread ttk via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 19:53:03 UTC, BoQsc wrote: Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this is only initial proof. Improved example with the

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 20:05:52 UTC, ttk wrote: On Wednesday, 3 June 2020 at 19:53:03 UTC, BoQsc wrote: Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 03, 2020 at 08:43:43PM +, BoQsc via Digitalmars-d-learn wrote: > On Wednesday, 3 June 2020 at 20:05:52 UTC, ttk wrote: [...] > > That works, but consider using chomp() instead. > > > > https://dlang.org/phobos/std_string.html#.chomp > > Chomp sounds kind of funny hahaha. > Who

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 18:49:38 UTC, ttk wrote: On Wednesday, 3 June 2020 at 18:23:51 UTC, BoQsc wrote: Here you can see ". hahahahahahaha" and "nononono" and even lineNumber is being merged into the same position. Why is this happening and can this be simply resolved? Your string in

Re: I want Sublime 3 D auto import !

2020-06-03 Thread bauss via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 11:54:57 UTC, Виталий Фадеев wrote: On Tuesday, 2 June 2020 at 20:08:09 UTC, bauss wrote: What happens if you have the same symbol in multiple modules? Ex. two libraries that implement symbols with same name. First module will inserted. Is there a way to be

Re: What's the best way to find out which exceptions may be thrown ?

2020-06-03 Thread FeepingCreature via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 13:58:13 UTC, Bienlein wrote: Because of the problems with checked exceptions they were deliberately left out in C#. Here is an interview with Anders Hejlsberg, the creator of C# at MS, where he explains the reasons for this decision: