On Saturday, 19 November 2022 at 05:42:03 UTC, []() {}() wrote:
those public Get/Set members functions are exactly what you get
in C#, except the compiler does it for you, behind the scenes,
saving you the keystokes.. but the end code is just as if you
had typed them out yourself.
I know...
On Saturday, 19 November 2022 at 04:47:57 UTC, thebluepandabear
wrote:
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229042(v=vs.100)
Thanks, I'll think about it more -- I am a noob so I may be
wrong in what I am saying.
Of course in C# this argument wouldn't
On Saturday, 19 November 2022 at 03:52:41 UTC, thebluepandabear
wrote:
...
.
Honestly, it may not be a magic bullet, but still useful.
This refactoring may be source compatible, but would it be binary
compatible?
i.e. you refactor your class, compile it as an updated version of
your lib
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms229042(v=vs.100)
Thanks, I'll think about it more -- I am a noob so I may be wrong
in what I am saying.
Of course in C# this argument wouldn't exist because you could
just do `{ get; set; }`, and I really wish D ha
On Saturday, 19 November 2022 at 04:37:51 UTC, thebluepandabear
wrote:
Thankfully I only code in D as a hobby, so I don't need to use
getters/setters! Thanks.
well, in that case, you can throw out everything that programmers
have learnt over many decades, and just to whatever you want in
yo
On Saturday, 19 November 2022 at 04:27:14 UTC, []() {}() wrote:
On Saturday, 19 November 2022 at 04:19:01 UTC, thebluepandabear
wrote:
oh. so i get it now. you have to refactor your class (change
member variable names and also do it in all places where they
are used througout the class. then
On Saturday, 19 November 2022 at 04:19:01 UTC, thebluepandabear
wrote:
oh. so i get it now. you have to refactor your class (change
member variable names and also do it in all places where they
are used througout the class. then add new methods,
overloading them in this way and that way, all
classes, and as such you will have a good chunk of code that is
practically useless and doing nothing.
Meant *fields not variables, excuse my terminology.
oh. so i get it now. you have to refactor your class (change
member variable names and also do it in all places where they
are used througout the class. then add new methods, overloading
them in this way and that way, all because you're initial
design never factored in the possibility of chan
On Saturday, 19 November 2022 at 03:52:41 UTC, thebluepandabear
wrote:
On Saturday, 19 November 2022 at 03:39:18 UTC, []() {}() wrote:
On Saturday, 19 November 2022 at 03:22:12 UTC,
thebluepandabear wrote:
On Saturday, 19 November 2022 at 03:19:53 UTC, []() {}()
wrote:
On Thursday, 17 November
If you only want to add setters:
```
class Rect2D {
int _width;
int _height;
void width(int width) {
writeln("SET");
this._width = width;
}
void height(int height) {
writeln("SET");
this._height = height;
}
}
```
A better example of a code refactor after adding getters/setters
is changing the names of the fields like so:
```
class Rect2D {
int _width;
int _height;
```
or
```
class Rect2D {
int width_;
int height_;
```
On Saturday, 19 November 2022 at 03:52:41 UTC, thebluepandabear
wrote:
On Saturday, 19 November 2022 at 03:39:18 UTC, []() {}() wrote:
On Saturday, 19 November 2022 at 03:22:12 UTC,
thebluepandabear wrote:
On Saturday, 19 November 2022 at 03:19:53 UTC, []() {}()
wrote:
On Thursday, 17 November
On Saturday, 19 November 2022 at 03:38:26 UTC, jwatson-CO-edu
wrote:
Thank you, something similar to what you suggested reduced the
atom size from 72 bytes to 40.
Oh, based on another forum post I added constructors in addition
to reducing the atom size 44%.
```d
struct Atom{
F_Type kin
On Saturday, 19 November 2022 at 03:39:18 UTC, []() {}() wrote:
On Saturday, 19 November 2022 at 03:22:12 UTC, thebluepandabear
wrote:
On Saturday, 19 November 2022 at 03:19:53 UTC, []() {}() wrote:
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
..
D has far less need for getters/s
On Saturday, 19 November 2022 at 03:24:41 UTC, thebluepandabear
wrote:
I think because of uniform function call syntax,
getters/setters are not needed even for production level code,
in D of course. In Java, you do need them so your point holds
true in that scenario, but in D I don't really s
On Saturday, 19 November 2022 at 03:22:12 UTC, thebluepandabear
wrote:
On Saturday, 19 November 2022 at 03:19:53 UTC, []() {}() wrote:
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
..
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
S
On Thursday, 17 November 2022 at 22:49:37 UTC, H. S. Teoh wrote:
Just create a nested anonymous struct, like this:
struct Atom {
F_Type kind;
union { // anonymous union
struct {
Atom* car; /
On Saturday, 19 November 2022 at 03:19:53 UTC, []() {}() wrote:
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
..
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Syntax](https://ddili.org/ders/d.en/ufcs.html). This means
that a member
On Saturday, 19 November 2022 at 03:14:18 UTC, []() {}() wrote:
On Saturday, 19 November 2022 at 03:08:05 UTC, thebluepandabear
wrote:
It likely already does something, in that- >'it allows for
change to occur without having to break the clients
interface'.
That too is the 'point' missing f
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
..
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Syntax](https://ddili.org/ders/d.en/ufcs.html). This means that
a member of a `struct` or `class` can start out as a normal
field and be
On Saturday, 19 November 2022 at 03:08:05 UTC, thebluepandabear
wrote:
It likely already does something, in that- >'it allows for
change to occur without having to break the clients interface'.
That too is the 'point' missing from that rant.
With all due respect, I think your point is mostl
It likely already does something, in that- >'it allows for
change to occur without having to break the clients interface'.
That too is the 'point' missing from that rant.
With all due respect, I think your point is mostly invalid due to
the point that Dukc made.
On Saturday, 19 November 2022 at 03:04:41 UTC, thebluepandabear
wrote:
On Saturday, 19 November 2022 at 00:25:57 UTC, Gavin Ray wrote:
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Synt
On Saturday, 19 November 2022 at 00:25:57 UTC, Gavin Ray wrote:
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Syntax](https://ddili.org/ders/d.en/ufcs.html). This means
that a member of
On Thursday, 17 November 2022 at 09:52:11 UTC, Dukc wrote:
D has far less need for getters/setters than Java or C++. The
reason is [Uniform Function Call
Syntax](https://ddili.org/ders/d.en/ufcs.html). This means that
a member of a `struct` or `class` can start out as a normal
field and be la
On Friday, 18 November 2022 at 20:18:41 UTC, matheus wrote:
On Friday, 18 November 2022 at 09:42:21 UTC, []() {}() wrote:
...
I think you missed the point of that video very badly.
By the way just a few points from that video:
Around: 2:32 -> "Never ever put in an 'accessor' until it
actual
On Friday, 18 November 2022 at 09:42:21 UTC, []() {}() wrote:
...
I think you missed the point of that video very badly.
By the way just a few points from that video:
Around: 2:32 -> "Never ever put in an 'accessor' until it
actually does something...".
Around: 3:10 -> "If there is an 'acc
On Fri, Nov 18, 2022 at 11:51:42AM +, thebluepandabear via
Digitalmars-d-learn wrote:
A question I have been thinking about whilst using D is how
often I
should be using const.
You should use it as often as you need to use it, and no more.
If you
don't need to use it, don't use it.
Ma
On Friday, 18 November 2022 at 11:51:42 UTC, thebluepandabear
wrote:
A question I have been thinking about whilst using D is how
often I should be using const.
This should be a good read for you:
[Is there any real reason to use
"const"?](https://forum.dlang.org/post/dkkxcibwdsndbckon...@foru
A question I have been thinking about whilst using D is how often
I should be using const.
Many people claim that all variables should be const by default,
but whether or not it is really needed is debatable and
oftentimes making everything const could cause readability issues
and make the co
On Friday, 18 November 2022 at 11:51:42 UTC, thebluepandabear
wrote:
A question I have been thinking about whilst using D is how
often I should be using const.
Many people claim that all variables should be const by
default, but whether or not it is really needed is debatable
and oftentimes m
On Thursday, 17 November 2022 at 09:46:57 UTC, matheus wrote:
Food for thought:
https://yewtu.be/watch?v=_xLgr6Ng4qQ
or
https://www.youtube.com/embed/_xLgr6Ng4qQ
Matheus.
'Food for thought'? Sure, if you're feeding that to your dog.
Public fields in 'class' definitions rarely have place i
33 matches
Mail list logo