digitalmars.D - D Properties when?
- Hipreme (13/13) Dec 14 2023 This is no news in the programming world, yet, we still don't
- jmh530 (32/45) Dec 14 2023 I'm not entirely sure what you mean, but what about something
- Timon Gehr (3/17) Dec 14 2023 https://wiki.dlang.org/DIP24
- Dom DiSc (3/5) Dec 15 2023 Sorry, this would break only code that was already broken. So
- Timon Gehr (15/23) Dec 17 2023 Personally, I am all for breaking code, but my understanding is we are
- ryuukk_ (18/31) Dec 14 2023 a function is a function, a field is a field
- IGotD- (3/4) Dec 14 2023 Data binding with properties in C# rocks big time, and it can be
- Max Samukha (3/9) Dec 14 2023 It is no more useless than any other syntactic convenience. And
- Timon Gehr (3/5) Dec 14 2023 Unnecessary distinction, making compiler complain for no reason, taking
- Hipreme (7/42) Dec 15 2023 Tagged Union can easily be implemented as library solutions, and
- Richard (Rikki) Andrew Cattermole (7/8) Dec 15 2023 Tuples can be productivity features.
- Quirin Schroll (6/13) Dec 20 2023 This is funny now because native tuples and pattern matching are
- ryuukk_ (7/22) Dec 20 2023 Java as well, they are all trying to catch up to the real
- H. S. Teoh (10/16) Dec 14 2023 Just add the appropriate opOpAssign overload. Use templates to reduce
This is no news in the programming world, yet, we still don't have it. This is very important for I can define a good API in which I could increase my engine performance. With that, I could implement fields with dirty flags and not make the API looks dirty (no pun intended). Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.
Dec 14 2023
On Thursday, 14 December 2023 at 18:08:52 UTC, Hipreme wrote:This is no news in the programming world, yet, we still don't have it. This is very important for I can define a good API in which I could increase my engine performance. With that, I could implement fields with dirty flags and not make the API looks dirty (no pun intended). Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.I'm not entirely sure what you mean, but what about something like this: ```d import std.stdio: writeln; struct Direction { int x; alias x this; private bool _dirty; void opOpAssign(string op: "+")(int rhs) { x += rhs; _dirty = true; } } struct Foo { Direction x; Direction y; this(int x, int y) { this.x = Direction(x); this.y = Direction(y); } } void main() { auto f = Foo(1, 2); f.x += 50; writeln(f.x._dirty); writeln(f.y._dirty); } ```
Dec 14 2023
On 12/14/23 19:08, Hipreme wrote:This is no news in the programming world, yet, we still don't have it. This is very important for I can define a good API in which I could increase my engine performance. With that, I could implement fields with dirty flags and not make the API looks dirty (no pun intended). Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.https://wiki.dlang.org/DIP24 Doing those right is a breaking change, so maybe with editions.
Dec 14 2023
On Thursday, 14 December 2023 at 18:52:03 UTC, Timon Gehr wrote:https://wiki.dlang.org/DIP24 Doing those right is a breaking change, so maybe with editions.Sorry, this would break only code that was already broken. So should not hinder us to implement it.
Dec 15 2023
On 12/15/23 13:15, Dom DiSc wrote:On Thursday, 14 December 2023 at 18:52:03 UTC, Timon Gehr wrote:No worries, it does not offend me.https://wiki.dlang.org/DIP24 Doing those right is a breaking change, so maybe with editions.Sorry,this would break only code that was already broken.Personally, I am all for breaking code, but my understanding is we are no longer engaging in that until editions are set up.So should not hinder us to implement it.I think the main hindrances to implementing it are: - You need to understand what is the correct fix. (I think it is obvious but somehow people still seem to have different views on this.) - You need to figure out the relevant DMD code (which could be _a lot_ of separate locations) and actually fix it. - The changes are unlikely to make it in before editions, at which point you will have to update the changes in order to be compatible with editions. But by all means, go ahead. Just be prepared for a bit of a headache while getting it to work and to then repeatedly rebase highly sprinkled out changes for a significant duration of time and/or to reimplement it multiple times.
Dec 17 2023
On Thursday, 14 December 2023 at 18:08:52 UTC, Hipreme wrote:This is no news in the programming world, yet, we still don't have it. This is very important for I can define a good API in which I could increase my engine performance. With that, I could implement fields with dirty flags and not make the API looks dirty (no pun intended). Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.a function is a function, a field is a field mixing the two is a bad idea, you think you get a field, but under the food it does weird stuff `properties` is nitpicking, making things more confusing that they should be it's the same nitpicking as: ```D int my_dumb_function() => 1 + 1; ``` this stuff is useless, takes development time to implement, and produce 0 value, literally confusing and useless i'd rather the language focus on what _really_ matter, areas where D falls behind serious competition (Rust/Zig/Odin/Nim/Swift) - native tuple: multiple return value - tagged union: improved enum/union - pattern matching: improved switch
Dec 14 2023
On Thursday, 14 December 2023 at 19:49:35 UTC, ryuukk_ wrote:a variable or function. Love it.
Dec 14 2023
On Thursday, 14 December 2023 at 19:49:35 UTC, ryuukk_ wrote:it's the same nitpicking as: ```D int my_dumb_function() => 1 + 1; ``` this stuff is useless, takes development time to implement, and produce 0 value, literally confusing and uselessIt is no more useless than any other syntactic convenience. And what is confusing about it?
Dec 14 2023
On 12/14/23 20:49, ryuukk_ wrote:a function is a function, a field is a fieldUnnecessary distinction, making compiler complain for no reason, taking up development time.
Dec 14 2023
On Thursday, 14 December 2023 at 19:49:35 UTC, ryuukk_ wrote:On Thursday, 14 December 2023 at 18:08:52 UTC, Hipreme wrote:Tagged Union can easily be implemented as library solutions, and ought to take a lot more time than implementing a simple feature which brings real value to development. About the others, I could not care less, the library tuples+aliasseq are just enough for me, tuples are a lot more confusing and code that overuse it is *always* bad. I want real productivity features.This is no news in the programming world, yet, we still don't have it. This is very important for I can define a good API in which I could increase my engine performance. With that, I could implement fields with dirty flags and not make the API looks dirty (no pun intended). Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.a function is a function, a field is a field mixing the two is a bad idea, you think you get a field, but under the food it does weird stuff `properties` is nitpicking, making things more confusing that they should be it's the same nitpicking as: ```D int my_dumb_function() => 1 + 1; ``` this stuff is useless, takes development time to implement, and produce 0 value, literally confusing and useless i'd rather the language focus on what _really_ matter, areas where D falls behind serious competition (Rust/Zig/Odin/Nim/Swift) - native tuple: multiple return value - tagged union: improved enum/union - pattern matching: improved switch
Dec 15 2023
On 16/12/2023 12:41 AM, Hipreme wrote:I want real productivity features.Tuples can be productivity features. Between them, sumtypes and our excellent CT introspection capabilities, you can write up the data representation for some web form and have it generate it in a very short time frame. Tuples are a key data representation in mathematics everything devolves to them, it'll help us in some surprising ways.
Dec 15 2023
On Thursday, 14 December 2023 at 19:49:35 UTC, ryuukk_ wrote:Noted.i'd rather the language focus on what _really_ matter, areas where D falls behind serious competition (Rust/Zig/Odin/Nim/Swift) - native tuple: multiple return value - tagged union: improved enum/union - pattern matching: improved switchThis is funny now because native tuples and pattern matching are proposal](https://github.com/dotnet/csharplang/blob/main/proposals/disc doesn’t have it would be plain wrong.)
Dec 20 2023
On Wednesday, 20 December 2023 at 17:28:48 UTC, Quirin Schroll wrote:On Thursday, 14 December 2023 at 19:49:35 UTC, ryuukk_ wrote:Java as well, they are all trying to catch up to the real competition, let's not match people who want to catch up, let's lead instead, hence my comment If i had interests in compilers, i would have sent various PRs already, alas, i'm only interested in working on my gameNoted.i'd rather the language focus on what _really_ matter, areas where D falls behind serious competition (Rust/Zig/Odin/Nim/Swift) - native tuple: multiple return value - tagged union: improved enum/union - pattern matching: improved switchThis is funny now because native tuples and pattern matching proposal](https://github.com/dotnet/csharplang/blob/main/proposals/disc doesn’t have it would be plain wrong.) too.
Dec 20 2023
On Thu, Dec 14, 2023 at 06:08:52PM +0000, Hipreme via Digitalmars-d wrote: [...]Think of an object with X and Y position. I want to be able to when its value changes, it sets a dirty flag to true. The problem is that I'm unable to do `X+= 50` after that. I need to do `X = X + 50`, this is not news but still makes the API inconsistent and more verbose. I don't care how this is implemented, I only want this some day to not make it look ugly.Just add the appropriate opOpAssign overload. Use templates to reduce the boilerplate to a minimum (this is why D's operator overloads are templates taking the operator as a CT string parameter, as opposed to forcing you to write 10 overloads to support 10 combinations of operators). T -- IBM = I'll Buy Microsoft!
Dec 14 2023