Re: `in` parameters optimization

2019-12-25 Thread Meta via Digitalmars-d-learn

On Wednesday, 25 December 2019 at 01:24:52 UTC, Adnan wrote:
Does the compiler automatically pass values by reference if 
possible with `in` parameters in higher level of optimization 
flags? I would normally use `in ref` but sometimes it's not 
compatible with different types.


No. "in" is short for "const scope" 
(https://dlang.org/spec/function.html#param-storage). The only 
mechanism D has for expressing "pass this argument by ref if 
possible, and by value otherwise" is "auto ref" 
(https://dlang.org/spec/function.html#auto-ref-functions), which 
requires your function to be templated.


Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-25 Thread Mike Parker via Digitalmars-d-learn

On Wednesday, 25 December 2019 at 10:57:45 UTC, Ron Tarrant wrote:

On Tuesday, 24 December 2019 at 16:43:06 UTC, Mike Parker wrote:
But now that VS Code's

performance is within my tolerance range


Just curious what you mean by this, Mike.


For a while, typing in VS Code was clunky compared to Sublime. I 
gave it a spin every couple of months to see how it was shaping 
up and eventually I stopped noticing the difference.


Re: Concatenation/joining strings together in a more readable way

2019-12-25 Thread mipri via Digitalmars-d-learn

On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote:

Are there any other ways to join two strings without Tilde ~
character?
I can't seems to find anything about Tilde character 
concatenation easily, nor the alternatives to it. Can someone

share some knowledge on this or at least point out useful
links/resources?


Huh?

For clarity I'm going to respond to some potential rewrites of
your question.


I don't think "foo" ~ "bar" is very readable. Can I use a
different syntax?


No. That's the syntax. Even if you customize it in your own
code, by overloading addition or the like, you'll still come
across it in other people's code. So I can only recommend that
you find some way to make it readable for you. Maybe use a
different or larger font? Maybe just get more familiar with it?

I don't think the syntax is likely to change.


Where can I find documentation for the ~ operator?


It's under 'expressions' in the spec:

https://dlang.org/spec/expression.html#cat_expressions


Is ~ the best way to join strings together? Can I use
something else?


You can use it to join arrays in general, including strings.
Depending on your use case you might prefer joiner()

https://dlang.org/phobos/std_algorithm_iteration.html#.joiner

in usage like

  assert(["many", "strings"].joiner("").array == "manystrings");

Or Appender, for many mutating appends to the same array:

https://dlang.org/phobos/std_array.html#Appender



Re: Concatenation/joining strings together in a more readable way

2019-12-25 Thread Tobias Pankrath via Digitalmars-d-learn

On Wednesday, 25 December 2019 at 12:39:08 UTC, BoQsc wrote:
Are there any other ways to join two strings without Tilde ~ 
character?
I can't seems to find anything about Tilde character 
concatenation easily, nor the alternatives to it. Can someone 
share some knowledge on this or at least point out useful 
links/resources?


Tilde operator is documented under cat expression: 
https://dlang.org/spec/expression.html#cat_expressions


An alternative would be std.algorithm.joiner: 
https://dlang.org/phobos/std_algorithm_iteration.html#.joiner


Concatenation/joining strings together in a more readable way

2019-12-25 Thread BoQsc via Digitalmars-d-learn
Are there any other ways to join two strings without Tilde ~ 
character?
I can't seems to find anything about Tilde character 
concatenation easily, nor the alternatives to it. Can someone 
share some knowledge on this or at least point out useful 
links/resources?


Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-25 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 22 December 2019 at 17:20:51 UTC, BoQsc wrote:
What kind of editor/IDE are you using and which one do you like 
the most?


I was using PSPad up until a few months ago when I realized 
Notepad++ (finally) has a 64-bit version of the Explorer plugin. 
With custom GtkD syntax highlighting for both, it was Notepad++'s 
ability to show me my working system directory in a sidebar on 
start-up that got me to switch. PSPad will show it, but only 
after I manually switch from project view.




Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-25 Thread Ron Tarrant via Digitalmars-d-learn

On Tuesday, 24 December 2019 at 16:43:06 UTC, Mike Parker wrote:
But now that VS Code's

performance is within my tolerance range


Just curious what you mean by this, Mike.