On Sunday, 17 April 2022 at 18:25:32 UTC, Bastiaan Veelo wrote:
The reason is in [17.1.5](https://dlang.org/spec/enum.html):
“EnumBaseType types cannot be implicitly cast to an enum type.”
Thy. That's the anchor in the specs preventing Enums to be
integral types.
In the specs(17) about enums the word "integral" has no match.
But because the default basetype is `int`, which is an integral
type, enums might be integral types whenever their basetype is an
integral type.
On the other hand the specs(7.6.5.3) about types say
| A bool value can be implicitly
On Tuesday, 14 December 2021 at 08:28:01 UTC, WebFreak001 wrote:
[...]
Alternatively, remove the template `()` from your `struct
Header`
What is the semantic sense of a template having no parameters?
Although the documentation declares such a template to be
syntactically correct, not a
On Monday, 22 June 2020 at 02:16:52 UTC, user1234 wrote:
[...]
Maybe that the spec is a bit vague as it doesn't mention that
[...]
A vague place in a spec is usually called "Dark Corner" and the
functionality then marked as "Implementation defined".
But this mark is missing here.
And
https://dlang.org/spec/module.html#name_lookup contains under
4.3.4 only two sentences.
While the first sentence explains, that the search ends
"as soon as a matching symbol is found",
the second sentence implies that the search may continue until it
is sure, that
no other symbol "with
On Monday, 13 April 2020 at 05:54:52 UTC, evilrat wrote:
if (auto weapon = cast(Weapon) gi)
weapon.Attack();
Does the parlor (currently illegal in Dlang)
if (Weapon w := gi)
w.Attack();
look nicer or even (currently legal):
if (Weapon w ._= gi)
On Monday, 9 March 2020 at 16:44:55 UTC, Steven Schveighoffer
wrote:
You're not the first person to ask.
Accepted.
Having a function `f' overloaded for argument types `bool' and
`ulong', the specs guarantee, that for `f( 1uL)' the boolean
overload of `f' is called.
What is this good for?
On Thursday, 3 January 2019 at 18:11:43 UTC, Paul Backus wrote:
[...] functions [...] default to `%s`.
thx. I should have rtfm instead of looking for an example.
-manfred
According to this tutorial
https://wiki.dlang.org/Defining_custom_print_format_specifiers
it seems easy to change the format of the output for
`std.stdio.writef'.
But why is there no example for changing the output when there
are no format specifiers?
-manfred
Timon Gehr wrote:
template getDepth(T){
static if(is(T==Set!S,S)) enum getDepth=1+getDepth!S;
else enum getDepth=0;
}
Thx. Seems that I have to relearn a lot.
-manfred
Matt Kline wrote:
isn't making any use of the template argument T
Correct. I do not know how to use `T' to determine the recursion depth of
the template---and I want no further parameter.
-manfred
How can one determine the recursion depth for templated types?
Example code:
import std.stdio;
class Set(T){
override string toString(){
return Set;
}
}
void main(){
auto s0= new Set!uint;
writeln( s0); // writes Set
auto s1= new Set!(Set!uint);
writeln( s1); // should write
Dennis Ritchie wrote:
if (4 = 5 = 6):
print (OK)
-
I would rather write:
if( isSorted![4,5,6])
-manfred
core.exception.AssertError@stackext.d(0): Assertion failure
how to handle this?
-manfred
Adam D. Ruppe wrote:
assert inside a mixed in string.
None praesent:
private import star, stack;
class StackExtended( T): Stack!T{
Star!T stacked;
this(){ stacked= new Star!T;}
auto opOpAssign( string op, T)( T node){
stacked+= node;
return super+= node;
}
auto opUnary(
Adam D. Ruppe wrote:
My first gut idea
Turns out: it is the usage of a variable
- not newed, and
- of a type declared in the file.
-manfred
Jonathan M Davis wrote:
UFCS is only ever used with the . syntax
The docs say so. Thx.
-manfred
Deprecation: super is not an lvalue
1) How to know when this will indeed be deprecated?
2) What does it mean, when `super++' is signalled as depracation, but
`super+=' is not signalled?
-manfred
Steven Schveighoffer wrote:
That seems like a bug.
https://issues.dlang.org/show_bug.cgi?id=14589
-manfred
The following gives:
Error: 'a += b' is not a scalar, it is a C
although UFCS should engage.
-manfred
class C{}
int main(){
void opOpAssign( string op)( C a, C b){
}
C a, b;
a+= b;
}
std.process.ProcessException@std\process.d(560):
Failed to spawn new process
This is the error-message from the D-script from
http://wiki.dlang.org/Building_DMD
-manfred
Jack Applegame wrote:
test(10); // error
One can import the declaration by using an alias:
class A {
void test(int) {}
}
class B : A {
alias test= super.test;
void test() {
super.test(1); // compiles
test(10); // compiles
}
}
-manfred
Dennis Ritchie wrote:
auto fact = function (int x) = x * { if (x) fact(x - 1); };
int fact (int x) { return x * ( x1 ? fact(x - 1): 1); };
-manfred
On Tuesday, 5 May 2015 at 05:26:17 UTC, anonymous wrote:
because `c is c`
Thanks. One can see this documented in
http://dlang.org/operatoroverloading.html#equals
But
1: how can one override this behavior
2: what is the design reason for this
Especially: how can one implement side effects
class C{
override bool opEquals( Object o){
return true;
}
}
unittest{
auto c= new C;
assert( c == c);
}
`rdmd --main -unittest -cov' shows, that opEquals is not
executed. Why?
-manfred
26 matches
Mail list logo