On 3/23/23 07:36, Alexander Zhirov wrote:
> @property auto toString(T)()
The name is misleading because you want types other than string as well.
> alias toString this;
That should have been a compilation error because 'toString' does not
have a known type (because it depends on a t
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov
wrote:
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to use an alias to this, but
it can only be used 1 time
}
auto a = MyVa
On Thursday, 23 March 2023 at 14:36:11 UTC, Alexander Zhirov
wrote:
On Thursday, 23 March 2023 at 14:19:31 UTC, user1234 wrote:
omg, let's rewrite this...
Or abuse opBinary
struct MyVal
{
string value;
T opBinary(string op, T)(T rhs)
if (op == "+")
{
On 3/23/23 06:38, Alexander Zhirov wrote:
> Is it possible to convert such records inside the structure to the
> assigned type?
D does not embrace implicit conversions. There is some support like
'alias this' as you mentioned but what you are looking for is not possible.
Ali
On Thursday, 23 March 2023 at 14:36:11 UTC, Alexander Zhirov
wrote:
I wanted WITHOUT explicit casting.
I also have thoughts about using
[templates](https://dlang.org/spec/template.html#this_rtti), but
I don't have enough experience yet how to implement it.
On Thursday, 23 March 2023 at 14:19:31 UTC, user1234 wrote:
omg, let's rewrite this...
I meant something like that. But you can't do that. I wanted
WITHOUT explicit casting.
```d
struct MyVal
{
private string value;
@property auto toString(T)()
{
return value.to!T;
}
On Thursday, 23 March 2023 at 14:17:25 UTC, user1234 wrote:
not exactly thing goal yet. The doc example you have put a link
for is different, the struct with alias this a redefinition of
the "alias this"'ed thing, that just cant work in what you ask
in the first post.
omg, let's rewrite this.
On Thursday, 23 March 2023 at 14:05:07 UTC, Alexander Zhirov
wrote:
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov
wrote:
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to us
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov
wrote:
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to use an alias to this, but
it can only be used 1 time
}
auto a = MyVa
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to use an alias to this, but it
can only be used 1 time
}
auto a = MyVal("100");
auto b = MyVal("11.2");
int MyInt = a;// Implicitl
On Thursday, 23 March 2023 at 11:46:48 UTC, matheus wrote:
On Thursday, 23 March 2023 at 09:39:40 UTC, John Xu wrote:
Anybody know any working REPL program? I failed to find a
working one.
https://github.com/dlang-community/drepl
can't compile on my Windows 10, dub reports:
...
According to
On Thursday, 23 March 2023 at 09:39:40 UTC, John Xu wrote:
Anybody know any working REPL program? I failed to find a
working one.
https://github.com/dlang-community/drepl
can't compile on my Windows 10, dub reports:
...
According to their Readme:
Supported OS
Works on any OS with full sha
Anybody know any working REPL program? I failed to find a working
one.
https://github.com/dlang-community/drepl
can't compile on my Windows 10, dub reports:
src\drepl\engines\dmd.d(258,16): Error: undefined identifier
`dlsym`
13 matches
Mail list logo