On Wednesday, 23 September 2020 at 04:15:51 UTC, mw wrote:
It's there because there _are_ times when it makes sense and
is useful, but it's definitely not safe, so you have to be
careful and know what you're doing.
What do you mean by saying "it's definitely not safe" here?
I mean: if I'm car
On Saturday, 27 October 2012 at 01:08:12 UTC, Jonathan M Davis
wrote:
On Saturday, October 27, 2012 01:09:39 Alex Rønne Petersen
wrote:
On 27-10-2012 01:03, Minas wrote:
> So the delete keyword has been deprecated - so good bye
> manual memory management...
Um, no. Use destroy() from the obje
On 9/22/20 11:31 PM, Steven Schveighoffer wrote:
I thought it had something to do with the optional parentheses.
I think it does have something to do with this. I think it works if you
do attrs[0], because you really get an alias to the function symbol, and
that calls it.
I still think I
On 9/22/20 10:20 PM, Adam D. Ruppe wrote:
On Wednesday, 23 September 2020 at 02:07:04 UTC, Steven Schveighoffer
wrote:
I just said pragma(msg, __traits(getAttributes, z))
Ah, ok, this is weird, `pragma(msg, __traits(getAttributes, z)[0])`
works just fine!
Oh, yeah, weird! I see that now. So
On Wednesday, 23 September 2020 at 02:07:04 UTC, Steven
Schveighoffer wrote:
I just said pragma(msg, __traits(getAttributes, z))
Ah, ok, this is weird, `pragma(msg, __traits(getAttributes,
z)[0])` works just fine!
But that might be adequate for you - just loop over the
attributes and use th
On Wednesday, 23 September 2020 at 01:57:08 UTC, Adam D. Ruppe
wrote:
On Wednesday, 23 September 2020 at 01:45:46 UTC, Steven
Schveighoffer wrote:
@foo int z; // Error: cannot interpret foo(T)(T val) at
compile time
Where do you get that error? Is it from phobos' thing? cuz I
copy/pasted your
On Wednesday, 23 September 2020 at 01:45:46 UTC, Steven
Schveighoffer wrote:
@foo int z; // Error: cannot interpret foo(T)(T val) at compile
time
Where do you get that error? Is it from phobos' thing? cuz I
copy/pasted your code and it compiled.
You can also just use a struct as the uda if y
I want to set up a way to use the following patterns:
@foo
@foo(val)
Is there a way I can define foo such that this works?
I tried this:
struct Foo(T)
{
T val;
}
auto foo(T)(T val) { return Foo!T(val); }
@property foo() { return Foo!int(0); }
So this works:
@foo() int x;
@foo(1) int y;
On Tuesday, 22 September 2020 at 18:21:10 UTC, Jacob Carlborg
wrote:
On 2020-09-19 21:50, Per Nordlöw wrote:
On Saturday, 19 September 2020 at 18:48:31 UTC, Jacob Carlborg
wrote:
A nested class seems to be able to escape the `this`
reference:
Ahh, thanks.
I just realized that it can escape i
On 9/22/20 2:53 PM, Kasra Sadeghi wrote:
On Tuesday, 22 September 2020 at 21:36:48 UTC, Ali Çehreli wrote:
...
alias Value = Algebraic!(int, double, string, None);
...
void main() {
printValue([Value(4.5), Value("hello"), Value(42)]);
}
Thanks! Wish there was a less redundant syntax for the
On Tuesday, 22 September 2020 at 09:32:13 UTC, drathier wrote:
What's the obvious way to put a timeout around a function call?
I'm thinking a 5 or 30 second timeout, and I'm expecting it to
pretty much never time out.
You have several options. Either you use the actor model
(spawn[Linked]) an
On 9/22/20 2:32 AM, drathier wrote:> What's the obvious way to put a
timeout around a function call? I'm
> thinking a 5 or 30 second timeout, and I'm expecting it to pretty much
> never time out.
I would start a thread and use receiveTimeout():
import std.concurrency;
import std.stdio;
import s
On Tuesday, 22 September 2020 at 21:36:48 UTC, Ali Çehreli wrote:
...
alias Value = Algebraic!(int, double, string, None);
...
void main() {
printValue([Value(4.5), Value("hello"), Value(42)]);
}
Thanks! Wish there was a less redundant syntax for the arrays.
On 9/22/20 2:30 PM, Kasra Sadeghi wrote:
Hi everyone!
What's the syntax for passing an array of Algebraics?
definition:
class None {}
class Value = Algebraic!(int, double, string, None);
That should be 'alias' instead of 'class':
import std.variant;
import std.stdio;
class None {}
alia
Hi everyone!
What's the syntax for passing an array of Algebraics?
definition:
class None {}
class Value = Algebraic!(int, double, string, None);
void printValue(Value[] values) {
foreach(value; values) {
value.writeln;
}
}
usage attempts:
printValue([4.5]);
printValue(Value
On Tuesday, 22 September 2020 at 13:19:10 UTC, Daniel Kozak wrote:
On Tue, Sep 22, 2020 at 3:05 PM claptrap via
Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
The thread title is...
"Why private methods cant be virtual?"
IE Not...
"how do I override private functions in a
On 2020-09-19 21:50, Per Nordlöw wrote:
On Saturday, 19 September 2020 at 18:48:31 UTC, Jacob Carlborg wrote:
A nested class seems to be able to escape the `this` reference:
Ahh, thanks.
I just realized that it can escape into other parameters without the
`scope` qualifier?
This
class Bar
On Tuesday, 22 September 2020 at 14:19:09 UTC, Steven
Schveighoffer wrote:
On 9/22/20 10:11 AM, Arafel wrote:
This is a very good guess. Specifically, I think classes (and
the mechanisms for inner classes and anonymous classes) were
added to D1 to allow porting of JWT to D.
Classes exis
On 9/22/20 10:11 AM, Arafel wrote:
My guess is that this was taken from Java, as in fact most of the D
class system seems to be (see `synchronized`, reference semantics, etc).
There it makes sense, because there is only one class per compilation
unit, so the `private` members are in effect hid
On 22/9/20 15:04, claptrap wrote:
The thread title is...
"Why private methods cant be virtual?"
IE Not...
"how do I override private functions in a non-polymorphic manner."
And what you suggest wont work because I was asking about virtual
functions, so I specifically want polymorphism. And
On Tuesday, 22 September 2020 at 13:19:10 UTC, Daniel Kozak wrote:
So final private functions can be overriden? It seems not, but
the sentence is definitely confusing if not just plain wrong.
Yeah. I've seen this called hiding, shadowing and overwriting
earlier, but never overriding - that's a
On Tue, Sep 22, 2020 at 3:05 PM claptrap via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
>
> The thread title is...
>
> "Why private methods cant be virtual?"
>
> IE Not...
>
> "how do I override private functions in a non-polymorphic manner."
>
> And what you suggest wont work
On Tuesday, 22 September 2020 at 10:23:08 UTC, Daniel Kozak wrote:
On Tue, Sep 22, 2020 at 11:06 AM claptrap via
Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
"Functions marked as final may not be overridden in a derived
class, unless they are also private"
So final priva
On 9/22/20 5:00 AM, claptrap wrote:
IE the compiler is supposed to make methods non-virtual automatically,
it should be easy to do for private as all the relevant info be in the
one compilation unit.
class A
{
private void foo() {}
}
class B(T) : A
{
static if(T.stringof == "BlahBlahBla
On Tue, Sep 22, 2020 at 1:30 PM ShadoLight via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
>
>
> This is not really "overriding", it is more akin to "overloading"
>
No it is not overloading, overloading is when you have more methods with
same name and differents params. It is
On Tuesday, 22 September 2020 at 10:23:08 UTC, Daniel Kozak wrote:
On Tue, Sep 22, 2020 at 11:06 AM claptrap via
Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote:
"Functions marked as final may not be overridden in a derived
class, unless they are also private"
So final priva
On Tue, Sep 22, 2020 at 11:06 AM claptrap via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
>
> "Functions marked as final may not be overridden in a derived
> class, unless they are also private"
>
> So final private functions can be overriden? It seems not, but
> the sentence i
On Tue, Sep 22, 2020 at 12:23 PM Daniel Kozak wrote:
> ...
> void main(string[] args)
> {
> B b = new B;
> b.overrideFun;
> }
>
You can have A and B in one module too of course
What's the obvious way to put a timeout around a function call?
I'm thinking a 5 or 30 second timeout, and I'm expecting it to
pretty much never time out.
On Tuesday, 22 September 2020 at 00:46:02 UTC, Steven
Schveighoffer wrote:
On 9/21/20 7:52 PM, H. S. Teoh wrote:
On Mon, Sep 21, 2020 at 07:43:30PM -0400, Steven Schveighoffer
via Digitalmars-d-learn wrote:
[...]
No, it's not a bug. It's intentional.
private and package functions are final, a
30 matches
Mail list logo