On Sunday, 8 August 2021 at 05:07:17 UTC, jfondren wrote:
On Sunday, 8 August 2021 at 04:51:48 UTC, someone wrote:
On Sunday, 8 August 2021 at 04:30:12 UTC, rikki cattermole
wrote:
So a field that will automatically be resolved to as part of
the behavior of generated toString methods.
No. A default property can be another object altogether. The
best use case I can think of is a default collection for a
class such as lobjComputers.computers in my example.
That really isn't what alias this is used for commonly. I.e.
I didn't know alias this even existed a month ago so I cannot
comment for what's oftenly used; I just stated that I was
pointed to alias this when I asked for default properties,
It might be that you were misunderstood. You're using "default
property" as a term of art with a specific meaning, and the
term itself looks generic enough that people can interpret it
with their familiar meanings for 'default' and 'property'.
Probably.
This is from Visual Basic, yeah?
Actually Visual FoxPro which had a full OOP implementation, for a
lot of reasons hated VB back then, but yes, Microsoft family of
developer tools have them and they were practical which is not to
say they should be good, maybe they are a terrible idea, and
*thats* why I was asking for advice beforehand.
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/how-to-declare-and-call-a-default-property
I've never run into like that before. And it doesn't seem
well-loved in VB: "Because of these disadvantages, you should
consider not defining default properties. For code readability,
you should also consider always referring to all properties
explicitly, even default properties."
This looks similar to that example:
```d
struct MsgBox {
string[] contents;
void opIndexAssign(string s, size_t i) {
if (contents.length <= i)
contents.length = i + 1;
contents[i] = s;
}
}
void main() {
import std.stdio : writeln;
MsgBox x;
x[0] = "Hello";
x[1] = " ";
x[2] = "World";
writeln(x.contents);
}
```
```
That I don't remember. But, if they were controversial back in
the day ... I think it is all said and done ... ain't it ?