On Monday, 4 October 2021 at 11:38:04 UTC, bauss wrote:
Actually it is covered by the spec.
See:
https://dlang.org/spec/expression.html#mixin_expressions
It clearly says:
```
Each AssignExpression in the ArgumentList is evaluated at
compile time
```
Which means that Br cannot be used in Ar
On Friday, 1 October 2021 at 14:26:39 UTC, jfondren wrote:
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote:
This code should work should mutual recursion be supported.
It still wouldn't work, because structs are value types and
it's impossible to say how large either struct is:
Err
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote:
I've been trying out templates in more depth and one thing I
was wondering was whether template expansions with circular
dependencies might work.
Here is an example that doesn't work:
```d
mixin(A!());
mixin(B!());
void main() {}
templ
On Saturday, 2 October 2021 at 08:48:24 UTC, Stephen wrote:
Is this by design?
No but it's easily explainable.
## without mixins
```d
struct Ar { Br b; ubyte a; }
struct Br { ubyte b; }
```
`Ar` semantic starts, members are analyzed, that begins with the
variable declaration `Br b`. `Br` ty
On Friday, 1 October 2021 at 14:26:39 UTC, jfondren wrote:
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote:
This code should work should mutual recursion be supported.
It still wouldn't work, because structs are value types and
it's impossible to say how large either struct is:
Err
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote:
This code should work should mutual recursion be supported.
It still wouldn't work, because structs are value types and it's
impossible to say how large either struct is:
Error: struct `mutualrec.Ar` no size because of forward referen
I've been trying out templates in more depth and one thing I was
wondering was whether template expansions with circular
dependencies might work.
Here is an example that doesn't work:
```d
mixin(A!());
mixin(B!());
void main() {}
template A() {
const char[] A = q{
struct Ar {
On Tuesday, 8 December 2020 at 22:01:52 UTC, Basile B. wrote:
On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote:
The following code fails to compile. Is this a compiler error
or if not what is wrong with the code?
What is wrong is that partial specialization is not correct.
The corr
On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote:
The following code fails to compile. Is this a compiler error
or if not what is wrong with the code?
What is wrong is that partial specialization is not correct.
The correct partial specialization is:
---
struct Template2(T)
{
e
following line is removed compilation succeeds
// without any other changes.
Template1!int x;
}
void main()
{
}
---
Failure message:
main.d(20): Error: struct main.Template1(Param1, Param2 =
Template2!Param1) recursive template expansion
main.d(20):while looking for match for
On Sunday, 21 October 2018 at 21:23:35 UTC, aliak wrote:
Hi, I'm playing around with a recursive template type that
allows for named template parameters. The problem is that it
requires a lot of repetition and becomes more error prone as
the number of named arguments increase. So
1
Hi, I'm playing around with a recursive template type that allows
for named template parameters. The problem is that it requires a
lot of repetition and becomes more error prone as the number of
named arguments increase. So
1) Any ideas on how to make it less error prone? less repetitio
07.05.2018 17:22, Timoses пишет:
On Monday, 7 May 2018 at 10:28:14 UTC, drug wrote:
I get the error like:
```
./foo/bar/baz/builder.d(57,23): Error: template instance
`staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive template
expansion
```
That's all. It doesn's print inst
On Monday, 7 May 2018 at 10:28:14 UTC, drug wrote:
I get the error like:
```
./foo/bar/baz/builder.d(57,23): Error: template instance
`staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive
template expansion
```
That's all. It doesn's print instantiations stack so I can't
I get the error like:
```
./foo/bar/baz/builder.d(57,23): Error: template instance
`staticMap!(DebugTypeMapper, BaseDebuggerTypes)` recursive template
expansion
```
That's all. It doesn's print instantiations stack so I can't track back
the reason. Could someone give an advice
On Wednesday, 21 March 2018 at 23:05:22 UTC, Jonathan M Davis
wrote:
On Wednesday, March 21, 2018 22:50:32 Ontonator via
Digitalmars-d-learn wrote:
On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote:
> On 03/21/2018 01:47 AM, Ontonator wrote:
>> The following code does not compile:
>>>
On Wednesday, March 21, 2018 22:50:32 Ontonator via Digitalmars-d-learn
wrote:
> On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote:
> > On 03/21/2018 01:47 AM, Ontonator wrote:
> >> The following code does not compile:
> >>> [...]
> >>
> >> It gives the error:
> >>> [...]
> >>
> >> The a
On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote:
On 03/21/2018 01:47 AM, Ontonator wrote:
The following code does not compile:
[...]
It gives the error:
[...]
The aliases do not have to be aliases, as long as there is
some reference to the class (e.g. method and variable
decl
{}
It gives the error:
test.d(12): Error: class `test.TemplatedClass(T : SuperClass)`
recursive template expansion
test.d(12): while looking for match for TemplatedClass!(C)
The aliases do not have to be aliases, as long as there is some
reference to the class (e.g. method and variable
lass {
> >
> > alias T = TemplatedClass!B;
> >
> > }
> >
> > class B : SuperClass {
> >
> > alias T = TemplatedClass!C;
> >
> > }
> >
> > class C : SuperClass {}
>
> It gives the error:
> > test.d(12): Error
: class `test.TemplatedClass(T : SuperClass)`
recursive template expansion
test.d(12):while looking for match for
TemplatedClass!(C)
The aliases do not have to be aliases, as long as there is some
reference to the class (e.g. method and variable declarations
also work). What exactly is
On 03/13/2017 11:58 PM, Stefan Koch wrote:
On Monday, 13 March 2017 at 22:05:24 UTC, Jack Applegame wrote:
Is this a bug?
No it's not
struct C
{
B!C;
}
is an error.
Howto compute C ? <--\
let's check the members; |
The member needs a template. |
Howto compute the template
On 03/14/2017 12:02 AM, Stefan Koch wrote:
On Monday, 13 March 2017 at 22:59:36 UTC, ag0aep6g wrote:
[...]
struct A(T) {
void m() {
char[T.sizeof] data;
}
}
/* ... rest as above ... */
I don't see how the destructor makes a difference. Soo, bug?
Try to use m.
Work
On Monday, 13 March 2017 at 22:59:36 UTC, ag0aep6g wrote:
On 03/13/2017 03:26 PM, Jack Applegame wrote:
I'm pretty sure that this code should compile
(https://dpaste.dzfl.pl/cf1e1ee6ef4b):
struct A(T) {
~this() {
char[T.sizeof] data;
}
}
struct B(T) {
A!T foo;
}
struct C {
On 03/13/2017 03:26 PM, Jack Applegame wrote:
I'm pretty sure that this code should compile
(https://dpaste.dzfl.pl/cf1e1ee6ef4b):
struct A(T) {
~this() {
char[T.sizeof] data;
}
}
struct B(T) {
A!T foo;
}
struct C {
B!C bar;
}
void main() {
C c;
}
But it doesn't:
On Monday, 13 March 2017 at 22:05:24 UTC, Jack Applegame wrote:
Is this a bug?
No it's not
struct C
{
B!C;
}
is an error.
Howto compute C ? <--\
let's check the members; |
The member needs a template. |
Howto compute the template ? |
let's compute the parameters. |
What
Is this a bug?
I'm pretty sure that this code should compile
(https://dpaste.dzfl.pl/cf1e1ee6ef4b):
struct A(T) {
~this() {
char[T.sizeof] data;
}
}
struct B(T) {
A!T foo;
}
struct C {
B!C bar;
}
void main() {
C c;
}
But it doesn't:
/d300/f416.d(3): Error: struct f416.C no size
Slightly simpler:
struct SomeType(K, V) {}
alias X(V) = V;
alias X(V, K...) = SomeType!(K[0], X!(V, K[1 .. $]));
That's a recurring pattern to get used to: aliasing away to one
of the parameters in a terminal and/or degenerate case. Also:
that an empty tuple matches no parameter "m
Thanks!
-Eric
On Saturday, 15 November 2014 at 18:49:32 UTC, anonymous wrote:
On Saturday, 15 November 2014 at 18:30:00 UTC, Eric wrote:
Hi -
I've never designed a recursive template before, but I think
that would solve my problem. What I would like is
someting like this:
class X
On Saturday, 15 November 2014 at 18:30:00 UTC, Eric wrote:
Hi -
I've never designed a recursive template before, but I think
that would solve my problem. What I would like is
someting like this:
class X(V, K...)
{
// I want to declare a type based on K and V such
// that for X!(V
Hi -
I've never designed a recursive template before, but I think
that would solve my problem. What I would like is
someting like this:
class X(V, K...)
{
// I want to declare a type based on K and V such
// that for X!(V, int, string, double) the resulting
// declaration wou
On 2013-11-26 21:31:55 +, bioinfornatics said:
On Tuesday, 26 November 2013 at 21:18:29 UTC, Shammah Chancellor wrote:
On 2013-11-26 21:00:56 +, bioinfornatics said:
On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote:
On Tuesday, 26 November 2013 at 20:29:00 UTC, bear
On Tuesday, 26 November 2013 at 21:18:29 UTC, Shammah Chancellor
wrote:
On 2013-11-26 21:00:56 +, bioinfornatics said:
On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics
wrote:
On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile
wrote:
bioinfornatics:
I wrote some template
On 2013-11-26 21:00:56 +, bioinfornatics said:
On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics wrote:
On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote:
bioinfornatics:
I wrote some template to compute at compile time how many bits is need
for a number x. http:/
On Tuesday, 26 November 2013 at 20:50:13 UTC, bioinfornatics
wrote:
On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote:
bioinfornatics:
I wrote some template to compute at compile time how many
bits is need for a number x.
http://www.dpaste.dzfl.pl/99a842fd
That works for small
On Tuesday, 26 November 2013 at 20:29:00 UTC, bearophile wrote:
bioinfornatics:
I wrote some template to compute at compile time how many bits
is need for a number x. http://www.dpaste.dzfl.pl/99a842fd
That works for small number but after i got an error about
limit recursion
Instead of te
bioinfornatics:
I wrote some template to compute at compile time how many bits
is need for a number x. http://www.dpaste.dzfl.pl/99a842fd
That works for small number but after i got an error about
limit recursion
Instead of template recursion, have you tried regular code run at
compile tim
Hi,
I wrote some template to compute at compile time how many bits is
need for a number x. http://www.dpaste.dzfl.pl/99a842fd
That works for small number but after i got an error about limit
recursion
how to work around this in my case ?
On 07/07/2013 01:22 PM, John Colvin wrote:
On Sunday, 7 July 2013 at 19:55:26 UTC, QAston wrote:
I have a large enum in my code (opcodes for a protocol) - using
std.traits.EnumMembers gives me a recursive template error.
How can i increase max number recursive template expansions?
I don
On 2013-07-08, 11:03, bearophile wrote:
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Filed:
http://d.puremagic.com/issues/show_bug.cgi?id=10569
And created a pull request:
https://github.com/D-Pro
On Monday, 8 July 2013 at 09:03:24 UTC, bearophile wrote:
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Bye,
bearophile
I reckon so. It's rare to have such huge structs or classes that
this sort of t
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Bye,
bearophile
On Sunday, 7 July 2013 at 20:28:12 UTC, John Colvin wrote:
On Sunday, 7 July 2013 at 20:22:59 UTC, Simen Kjaeraas wrote:
On 2013-07-07, 21:55, QAston wrote:
I have a large enum in my code (opcodes for a protocol) -
using std.traits.EnumMembers gives me a recursive template
error.
How can i
On Sunday, 7 July 2013 at 20:41:17 UTC, Simen Kjaeraas wrote:
On 2013-07-07, 22:28, John Colvin wrote:
We came up with almost identical solutions, posted within 19
seconds of each other!
Sorta. Mine does repeated halving, and makes DMD run out of
memory with
16384 enum members. Yours balks a
On 2013-07-07, 22:28, John Colvin wrote:
We came up with almost identical solutions, posted within 19 seconds of
each other!
Sorta. Mine does repeated halving, and makes DMD run out of memory with
16384 enum members. Yours balks at an enum of > about 1000 elements.
--
Simen
On Sunday, 7 July 2013 at 20:22:59 UTC, Simen Kjaeraas wrote:
On 2013-07-07, 21:55, QAston wrote:
I have a large enum in my code (opcodes for a protocol) -
using std.traits.EnumMembers gives me a recursive template
error.
How can i increase max number recursive template expansions?
You
On Sunday, 7 July 2013 at 19:55:26 UTC, QAston wrote:
I have a large enum in my code (opcodes for a protocol) - using
std.traits.EnumMembers gives me a recursive template error.
How can i increase max number recursive template expansions?
I don't think you can. Please file a bug report:
On 2013-07-07, 21:55, QAston wrote:
I have a large enum in my code (opcodes for a protocol) - using
std.traits.EnumMembers gives me a recursive template error.
How can i increase max number recursive template expansions?
You can't. However, you can amend std.traits.EnumMembers to work
I have a large enum in my code (opcodes for a protocol) - using
std.traits.EnumMembers gives me a recursive template error.
How can i increase max number recursive template expansions?
50 matches
Mail list logo