Re: What is the current stage of @property ?

2020-06-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 10, 2020 at 10:58:57PM -0600, Jonathan M Davis via Digitalmars-d-learn wrote: [...] > As things stand, @property has no real practical purpose but > frequently gets used to indicate that it's the intention of a > function's author for it to be used as if it were a variable. I >

Re: What is the current stage of @property ?

2020-06-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 10, 2020 3:41:54 PM MDT H. S. Teoh via Digitalmars-d-learn wrote: > On Wed, Jun 10, 2020 at 08:24:19PM +, Vinod K Chandran via Digitalmars- d-learn wrote: > > Hi all, > > I read in an old thread that authors of D wants to eliminate > > @property. I just roughly read the big

Re: What is the current stage of @property ?

2020-06-10 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 23:03:21 UTC, Adam D. Ruppe wrote: On Wednesday, 10 June 2020 at 22:50:17 UTC, Paul Backus wrote: static assert(isInputRange!S); // passes isInputRange doesn't check it but others do. std.random.isSeedable requires @property on front for example. Nope: struct

Re: What is the current stage of @property ?

2020-06-10 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 23:26:35 UTC, Paul Backus wrote: On Wednesday, 10 June 2020 at 23:03:21 UTC, Adam D. Ruppe wrote: On Wednesday, 10 June 2020 at 22:50:17 UTC, Paul Backus wrote: static assert(isInputRange!S); // passes isInputRange doesn't check it but others do.

Re: What is the current stage of @property ?

2020-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 22:50:17 UTC, Paul Backus wrote: static assert(isInputRange!S); // passes isInputRange doesn't check it but others do. std.random.isSeedable requires @property on front for example. Some apparently test incorrectly too, like std.range.primitives.moveFront

Re: What is the current stage of @property ?

2020-06-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 10, 2020 at 10:50:17PM +, Paul Backus via Digitalmars-d-learn wrote: > On Wednesday, 10 June 2020 at 21:41:54 UTC, H. S. Teoh wrote: > > There are a few places where it's needed (like satisfying the range > > API, which implicitly checks for it) > > That may have been true at one

Re: What is the current stage of @property ?

2020-06-10 Thread 12345swordy via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 22:30:37 UTC, Vinod K Chandran wrote: On Wednesday, 10 June 2020 at 22:15:25 UTC, 12345swordy wrote: It can't do binary operations and unary operations. @12345swordy, You mean we can't do such ops inside the property ? No, it means you can't do this: e.x +=

Re: What is the current stage of @property ?

2020-06-10 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:41:54 UTC, H. S. Teoh wrote: There are a few places where it's needed (like satisfying the range API, which implicitly checks for it) That may have been true at one point, but it isn't true now: struct S { bool empty() { return false; } int front() {

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 22:15:25 UTC, 12345swordy wrote: It can't do binary operations and unary operations. @12345swordy, You mean we can't do such ops inside the property ?

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:40:44 UTC, Paul Backus wrote: The current state of @property is that it doesn't really do anything. D allows you to call functions without parentheses, and to use assignment syntax to call a single-argument function, so you can write getters and setters that

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:41:54 UTC, H. S. Teoh wrote: It's stuck in limbo, like many things that people just cannot agree on. There are a few places where it's needed (like satisfying the range API, which implicitly checks for it), but for the most part, you can just ignore it, it

Re: What is the current stage of @property ?

2020-06-10 Thread 12345swordy via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:40:44 UTC, Paul Backus wrote: On Wednesday, 10 June 2020 at 20:24:19 UTC, Vinod K Chandran wrote: Hi all, I read in an old thread that authors of D wants to eliminate @property. I just roughly read the big thread bu couldn't find a conclusion. After all that

Re: What is the current stage of @property ?

2020-06-10 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 20:24:19 UTC, Vinod K Chandran wrote: Hi all, I read in an old thread that authors of D wants to eliminate @property. I just roughly read the big thread bu couldn't find a conclusion. After all that thread is a 48 page longer jumbo thread. So out of curiosity, i

Re: What is the current stage of @property ?

2020-06-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 10, 2020 at 08:24:19PM +, Vinod K Chandran via Digitalmars-d-learn wrote: > Hi all, > I read in an old thread that authors of D wants to eliminate > @property. I just roughly read the big thread bu couldn't find a > conclusion. After all that thread is a 48 page longer jumbo

What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I read in an old thread that authors of D wants to eliminate @property. I just roughly read the big thread bu couldn't find a conclusion. After all that thread is a 48 page longer jumbo thread. So out of curiosity, i am asking this. What is the current state of @property ? Is it

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 00:53:30 UTC, Seb wrote: [snip] Anyhow, I would be highly in favor of DMD doing this. It's one of those many things that I have on my list for D3 or a D fork. Chapel supports zippered iteration [1]. From the discussion here, it sounds very much like the

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Dukc via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 15:34:57 UTC, Steven Schveighoffer wrote: My biggest problem with enumerate is that you can't bind the tuple to parameters for something like map: arr.enumerate.map!((idx, val) => ...) doesn't work. Instead you have to do: arr.enumerate.map!((tup) => ...) And

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/9/20 7:53 PM, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing and     foreach (i, e; range) { ... } doesn't work from the get-go? I wouldn't have such an issue with it if static foreach would work with enumerate just fine. What is the use case for

Re: Alpine support for D

2020-06-10 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 12:59:33 UTC, Jesse Phillips wrote: On Wednesday, 10 June 2020 at 01:06:30 UTC, aberba wrote: On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing Someone already mentioned dictionary. Consider that most ranges don't actually have an index. In this case you aren't actually asking to add indexes, but a count of

Re: Alpine support for D

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 01:06:30 UTC, aberba wrote: On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level,

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 08:31:47 UTC, Mathias LANG wrote: On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: [...] Depending on your needs, it might be trivial. We use this, and it works accross all 3 platforms:

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: Hi, I would like to interface with the library https://github.com/NTNU-IHB/FMI4cpp and have following class definitions in the header file: ``` c++ namespace fmi4cpp { template class fmu_base { public: const

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread evilrat via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: Also, the C++ classes make use of templates. Is it still possible to call these classes from D? It should be, I did something similar and it worked. But it was quite some time ago so I don't remember exact situation and any

Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread Andre Pany via Digitalmars-d-learn
Hi, I would like to interface with the library https://github.com/NTNU-IHB/FMI4cpp and have following class definitions in the header file: ``` c++ namespace fmi4cpp { template class fmu_base { public: const std::string guid() const { return