Re: Best practices of using const

2019-06-21 Thread Yatheendra via Digitalmars-d-learn
It feels disingenous to want to call a caching object even "logically" const. There has to be a scaffolding-based but hopefully generic compromise. I haven't yet tested this belief, but I believe "physical" const is of good use wherever it can be applied. On Friday, 21 June 2019 at 23:39:20

Re: There is a computer languages benchmark compare site, but no Dlang benchmark. I think they should support D.

2019-06-21 Thread lithium iodate via Digitalmars-d-learn
On Saturday, 22 June 2019 at 01:27:31 UTC, lili wrote: A nick site, has a lot of languages, unfortunately no dlang in there. https://benchmarksgame-team.pages.debian.net/benchmarksgame/ This page frequently pops up in this forum, please refer to existing posts:

There is a computer languages benchmark compare site, but no Dlang benchmark. I think they should support D.

2019-06-21 Thread lili via Digitalmars-d-learn
A nick site, has a lot of languages, unfortunately no dlang in there. https://benchmarksgame-team.pages.debian.net/benchmarksgame/

Re: Best practices of using const

2019-06-21 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jun 21, 2019 at 06:32:33PM +, Yatheendra via Digitalmars-d-learn wrote: [...] >struct CostlyComputeResult { > ... // data fields > // constructor takes compute results, no postblit >} > >struct Wrapper { > const (CostlyComputeResult) *cachee = 0; >

Re: Options for unit testing in D?

2019-06-21 Thread Mike Brockus via Digitalmars-d-learn
On Friday, 21 June 2019 at 17:52:43 UTC, Mike Wey wrote: On 21-06-2019 06:08, Mike Brockus wrote: [...] If you are using the D unittests in your source you can recompile the same source with `d_unittest: true`, the appstream-generator project does this:

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 3:31:46 PM MDT KnightMare via Digitalmars-d-learn wrote: > On Friday, 21 June 2019 at 19:18:02 UTC, KnightMare wrote: > > On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: > > > > auto goodName( ... ) { > > > > pragma( inline, true ) > > return

Re: Transform a function's body into a string for mixing in

2019-06-21 Thread Emmanuelle via Digitalmars-d-learn
On Friday, 21 June 2019 at 15:54:35 UTC, Adam D. Ruppe wrote: On Friday, 21 June 2019 at 15:42:56 UTC, Emmanuelle wrote: [...] This sounds very similar to something I hacked together a while ago and recently wrote about making cleaner code:

Re: What is iota function full name

2019-06-21 Thread KnightMare via Digitalmars-d-learn
On Friday, 21 June 2019 at 19:18:02 UTC, KnightMare wrote: On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: auto goodName( ... ) { pragma( inline, true ) return terribleName( ... ); } hmm.. I have a question: this pragma will inline terribleName (double code) or

Re: Order of interfaces

2019-06-21 Thread Tomas via Digitalmars-d-learn
On Friday, 21 June 2019 at 20:50:02 UTC, user1234 wrote: On Friday, 21 June 2019 at 20:42:00 UTC, Tomas wrote: Does it matter in which order a class inherits from interfaces? class A : Interface1, Interface2{ ... } vs class A : Interface2, Interface1{ ... } Conceptually it should

Re: Order of interfaces

2019-06-21 Thread user1234 via Digitalmars-d-learn
On Friday, 21 June 2019 at 20:42:00 UTC, Tomas wrote: Does it matter in which order a class inherits from interfaces? class A : Interface1, Interface2{ ... } vs class A : Interface2, Interface1{ ... } Conceptually it should not matter, but I'm getting really weird segfault errors

Re: What is iota function full name

2019-06-21 Thread Marco de Wild via Digitalmars-d-learn
On Friday, 21 June 2019 at 19:18:02 UTC, KnightMare wrote: On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: On Friday, June 21, 2019 5:10:03 AM MDT JN via Some folks argued a while back that iota was a terrible name and that it should be changed, but it was decided not to

Order of interfaces

2019-06-21 Thread Tomas via Digitalmars-d-learn
Does it matter in which order a class inherits from interfaces? class A : Interface1, Interface2{ ... } vs class A : Interface2, Interface1{ ... } Conceptually it should not matter, but I'm getting really weird segfault errors with one version and no errors with the other version.

Re: What is iota function full name

2019-06-21 Thread KnightMare via Digitalmars-d-learn
On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: On Friday, June 21, 2019 5:10:03 AM MDT JN via Some folks argued a while back that iota was a terrible name and that it should be changed, but it was decided not to change it. auto terribleName( ... ) { } auto goodName( ...

Re: Best practices of using const

2019-06-21 Thread Yatheendra via Digitalmars-d-learn
That is a comprehensive reply. No pointers to other material required :-) On Friday, 21 June 2019 at 16:35:50 UTC, H. S. Teoh wrote: On Fri, Jun 21, 2019 at 06:07:59AM +, Yatheendra via Digitalmars-d-learn wrote: Actually, optimizers work best when there is minimal mutation *in the

Re: Options for unit testing in D?

2019-06-21 Thread Mike Wey via Digitalmars-d-learn
On 21-06-2019 06:08, Mike Brockus wrote: If you never herd about Meson before: 樂. https://mesonbuild.com/ I am wondering as to what options are available for a Meson build user when unit testing? What I am trying todo is simply rewrite my C17 project reference templates to D versions so I

Re: Best practices of using const

2019-06-21 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jun 21, 2019 at 06:07:59AM +, Yatheendra via Digitalmars-d-learn wrote: > Am I mistaken in saying that we are conflating: >"anything that is logically const should be declared const" No, not in D. D does not have logical const; it has "physical" const, which is a strict subset

Re: Transform a function's body into a string for mixing in

2019-06-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 21 June 2019 at 15:42:56 UTC, Emmanuelle wrote: Yeah, I want to be able to basically use mixin templates but with expressions instead, with the code being executed on the scope of the caller, not the callee; but it seems that's impossible without passing strings This sounds very

Re: Transform a function's body into a string for mixing in

2019-06-21 Thread Emmanuelle via Digitalmars-d-learn
On Thursday, 20 June 2019 at 20:38:48 UTC, Dennis wrote: On Thursday, 20 June 2019 at 19:09:11 UTC, Emmanuelle wrote: Is there any trait or Phobos function for transforming a function/delegate/lambda/whatever's body into a string suitable for `mixin(...)`? For example: See:

Trick for passing void* arrays around with typing

2019-06-21 Thread Bart via Digitalmars-d-learn
foo(cast(void*)[Object1, Object2]); foo(cast(bool delegate(void*))(Tuple!(X,Y) objects)) { }); One can pass arbitrary data as an array(the cast is ugly though) Then the tuple is cast back to void* but one can access objects correctly with typing. This works well when interacting with

Why can't 'scope' be inferred here?

2019-06-21 Thread Paul Backus via Digitalmars-d-learn
The following code fails to compile with -dip1000: struct Inner(T) { T value; this(ref T value) { this.value = value; } } struct Outer(T) { Inner!T inner; void opAssign(ref T rhs) { inner = Inner!T(rhs); } } @safe void main() { int x; int* p = Outer!(int*) o; o

Re: Options for unit testing in D?

2019-06-21 Thread XavierAP via Digitalmars-d-learn
On Friday, 21 June 2019 at 04:08:42 UTC, Mike Brockus wrote: I am wondering as to what options are available for a Meson build user when unit testing? Unit tests are part of the language in D: https://dlang.org/spec/unittest.html These are compiled when you (or whatever build system you

Blog Post #0046 - SpinButton

2019-06-21 Thread Ron Tarrant via Digitalmars-d-learn
Friday's post covers the SpinButton and its all-important Adjustment object companion. You can find it here: https://gtkdcoding.com/2019/06/21/0046-the-spinbutton.html Facelift Update Things are moving along nicely and I expect the fully-realized site to be unveiled within the next week.

Re: What is iota function full name

2019-06-21 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 21 June 2019 at 09:24:54 UTC, lili wrote: in dictionary iota means: a tiny or scarcely detectable amount the 9th letter of the Greek alphabet but this function is not that mean. Full answer: https://stackoverflow.com/questions/9244879/what-does-iota-of-stdiota-stand-for

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 5:10:03 AM MDT JN via Digitalmars-d-learn wrote: > On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote: > So, iota is > > > the name of the function, and it doesn't stand for anything. > > It's just the name of the Greek letter that was used for a > > similar

Re: What is iota function full name

2019-06-21 Thread JN via Digitalmars-d-learn
On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote: So, iota is the name of the function, and it doesn't stand for anything. It's just the name of the Greek letter that was used for a similar function in another language that most programmers these days have probably never heard

Re: What is iota function full name

2019-06-21 Thread KlausO via Digitalmars-d-learn
So basically iota spills Increments Over The Array. Am 21.06.2019 um 11:18 schrieb Jonathan M Davis: On Friday, June 21, 2019 3:01:17 AM MDT lili via Digitalmars-d-learn wrote: Hi Guys: What is range.iota function full name iota _is_ its full name. It's named after an STL function

Re: make C is scriptable like D

2019-06-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 20 June 2019 at 16:55:01 UTC, Jonathan Marler wrote: On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote: [...] rdmd adds a few different features as well, but the bigger thing it does is cache the results in a global temporary directory. So If you run rdmd on the

Re: What is iota function full name

2019-06-21 Thread lili via Digitalmars-d-learn
On Friday, 21 June 2019 at 09:09:33 UTC, aliak wrote: On Friday, 21 June 2019 at 09:01:17 UTC, lili wrote: Hi Guys: What is range.iota function full name That is the full name. Or what do you mean? Found on the internet somewhere: "The function is named after the integer function ⍳ from

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 3:01:17 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys: > What is range.iota function full name iota _is_ its full name. It's named after an STL function which does basically the same with iterators in C++: https://en.cppreference.com/w/cpp/algorithm/iota

Re: What is iota function full name

2019-06-21 Thread aliak via Digitalmars-d-learn
On Friday, 21 June 2019 at 09:01:17 UTC, lili wrote: Hi Guys: What is range.iota function full name That is the full name. Or what do you mean? Found on the internet somewhere: "The function is named after the integer function ⍳ from the programming language APL."

What is iota function full name

2019-06-21 Thread lili via Digitalmars-d-learn
Hi Guys: What is range.iota function full name

Re: Best practices of using const

2019-06-21 Thread Yatheendra via Digitalmars-d-learn
Am I mistaken in saying that we are conflating: "anything that is logically const should be declared const" // makes perfect sense // e.g. the lowest 2, and some branches of the 3rd and 4th, levels // of members (and a subset of the overall methods) in a 5-deep type hierarchy are