In this example:
const(AliasSeq!(int, int)) a;
pragma(msg, typeof(a)); // (int, int)
This kind of make sense, since AliasSeq is not a "single" type.
But silently dropping const seems bad, the compiler should
probably report an error/warning in this case?
This surprised me A LOT:
https://d.godbolt.org/z/82a_GZ
So if I call something.map!().array, I get an array of delegates?
That makes no sense to me.
Issue filed: https://issues.dlang.org/show_bug.cgi?id=19190
On Wednesday, 22 August 2018 at 11:59:37 UTC, Paolo Invernizzi
wrote:
Just found by chance, if someone is interested [1] [2].
/Paolo
[1]
https://gitlab.com/mihails.strasuns/blog/blob/master/articles/on_leaving_d.md
[2]
On Saturday, 25 August 2018 at 14:13:18 UTC, rikki cattermole
wrote:
On 26/08/2018 2:10 AM, Yuxuan Shui wrote:
The offending code base is a little big and hard to reduce.
I'll try if code is required, but here is the gist of the
problem:
This snippet of code in my project:
...
The offending code base is a little big and hard to reduce. I'll
try if code is required, but here is the gist of the problem:
This snippet of code in my project:
...
alias tmp = genCode!T;
enum str = tmp.str; // This line here
...
Generate a circular reference error.
On Friday, 10 August 2018 at 08:46:46 UTC, Kagamin wrote:
On Thursday, 9 August 2018 at 14:15:31 UTC, Yuxuan Shui wrote:
The alignment is specified for the section, and it apparently
kept. problem is individual symbols in the section don't have
a alignment.
If the section is aligned at 16
On Thursday, 9 August 2018 at 13:50:00 UTC, Kagamin wrote:
On Thursday, 9 August 2018 at 13:30:38 UTC, Yuxuan Shui wrote:
I searched around, and there seems to be no way to specify
alignment on symbol, so I don't think the linker is in the
wrong here.
The alignment should be specified for
Clarifications:
On Thursday, 9 August 2018 at 13:30:38 UTC, Yuxuan Shui wrote:
I'm trying to build LDC with dmd and Musl, but the result ldc
will always crash. I track that down to an unalignment SIMD
access to a global variable. Apparently C++ compiler thinks the
variable should be aligned
I'm trying to build LDC with dmd and Musl, but the result ldc
will always crash. I track that down to an unalignment SIMD
access to a global variable. Apparently C++ compiler thinks the
variable should be aligned to 16 bytes, but it's only aligned to
8 bytes.
After some more digging, I find
file1.d:
import std.stdio;
file2.d:
import file1;
pragma(msg, __traits(getProtection, __traits(getMember, m1,
"std"))); // public
pragma(msg, __traits(getProtection, m1.std)); // private
Bug? Intended?
On Saturday, 4 August 2018 at 21:10:32 UTC, Steven Schveighoffer
wrote:
On 8/4/18 4:10 PM, Yuxuan Shui wrote:
This doesn't work:
template A() {
void B() {};
}
template B() {
mixin A!();
}
void main() {
B!()();
}
Is this intentional?
I believe mixin templates introduce a new
This doesn't work:
template A() {
void B() {};
}
template B() {
mixin A!();
}
void main() {
B!()();
}
Is this intentional?
On Friday, 27 July 2018 at 10:48:08 UTC, ag0aep6g wrote:
On 07/27/2018 12:19 PM, Yuxuan Shui wrote:
On Friday, 27 July 2018 at 10:17:21 UTC, Yuxuan Shui wrote:
[...]
Oh no, is it just defining arrays in the is() statement,
though?
Yup.
But wait, this works:
alias C = A!(1,2,3);
static
On Friday, 27 July 2018 at 10:17:21 UTC, Yuxuan Shui wrote:
First, it surprised me that I can't index a struct like that.
So:
struct A(T...) {
alias S = T;
alias S this;
}
alias B = A!(int, double);
B[0] x; // Actually an array
Then, it surprised me again, that I actually can index
First, it surprised me that I can't index a struct like that. So:
struct A(T...) {
alias S = T;
alias S this;
}
alias B = A!(int, double);
B[0] x; // Actually an array
Then, it surprised me again, that I actually can index it,
sometimes
static if (!is(B[0] == B[1]))
pragma(msg,
On Friday, 6 July 2018 at 21:15:46 UTC, H. S. Teoh wrote:
On Fri, Jul 06, 2018 at 08:16:36PM +, Ecstatic Coder via
Digitalmars-d-announce wrote: [...]
I've never said that this is something smart to do. I'm just
saying that this code can perfectly be executed once in a C++
game frame
On Tuesday, 10 July 2018 at 11:37:25 UTC, ag0aep6g wrote:
On 07/10/2018 11:56 AM, Yuxuan Shui wrote:
Possible alternatives:
* struct Void {}. Takes 1 byte, not as ideal
* alias Void = AliasSeq!(). Doesn't work as template argument.
i.e.
SomeTemplate!Void; // actually become
On Tuesday, 10 July 2018 at 09:50:45 UTC, Yuxuan Shui wrote:
Suppose I want to create a type to contain either a return
value or an error, I could probably do something like this:
[...]
Breaking changes:
void[] x;
pragma(msg, x[0].sizeof); // now 0?
On Tuesday, 10 July 2018 at 09:50:45 UTC, Yuxuan Shui wrote:
Suppose I want to create a type to contain either a return
value or an error, I could probably do something like this:
[...]
Possible alternatives:
* struct Void {}. Takes 1 byte, not as ideal
* alias Void = AliasSeq!(). Doesn't
Suppose I want to create a type to contain either a return value
or an error, I could probably do something like this:
struct Result(T, E) {
bool is_err;
union {
T result;
E error;
}
}
This will probably work fine, unless I don't need an
On Sunday, 1 July 2018 at 18:03:41 UTC, Adam D. Ruppe wrote:
On Sunday, 1 July 2018 at 14:23:36 UTC, Yuxuan Shui wrote:
I was suggesting we do what Rust did. i.e. 'import foo',
imports foo.d, which can in turn do 'import foo.bar', which
will import foo/bar.d.
Yeah, that's the way it should
On Sunday, 1 July 2018 at 11:55:17 UTC, Jonathan M Davis wrote:
On Sunday, July 01, 2018 11:36:51 Yuxuan Shui via Digitalmars-d
wrote:
[...]
The entire reason that package.d was added as a feature was so
that modules could be split into packages without breaking
code, and it's still
In Rust, they have something call mod.rs, which is very similar
to package.d. When you use a module 'foo' in Rust, it can either
be 'foo.rs' or 'foo/mod.rs'. If 'foo' has sub-modules, it has to
be 'foo/mod.rs'.
Now in the Rust 2018 edition, they are getting rid of mod.rs. So
when you import
On Thursday, 14 June 2018 at 17:26:50 UTC, Johannes Pfau wrote:
Am Thu, 14 Jun 2018 01:19:30 + schrieb Yuxuan Shui:
Just ran into a problem where program will crash during stack
trace. Turns out not only does druntime not support compressed
debug info, it cannot handle it at all.
So I
Just ran into a problem where program will crash during stack
trace. Turns out not only does druntime not support compressed
debug info, it cannot handle it at all.
So I was thinking why don't we use a existing and proven library
for this, instead of roll our own?
On Saturday, 9 June 2018 at 07:56:08 UTC, Jonathan M Davis wrote:
Now that it is defined with DIP 1000, it seems like pretty much
everyone trying to use it has a hard time understanding it at
first (at least beyond the really simple cases).
It might have been because that the DIP is written
On Monday, 4 June 2018 at 11:28:26 UTC, rikki cattermole wrote:
Thought: Couldn't we have alternative names in the parameter
instead? E.g.
```D
void foo(int x/x0/width, int y/y0/height){}
```
This intuitively means that any combination of the parameter
names would work (e.g. (x, y0),
On Monday, 4 June 2018 at 10:30:18 UTC, rikki cattermole wrote:
On 04/06/2018 10:05 PM, Yuxuan Shui wrote:
On Monday, 4 June 2018 at 05:46:04 UTC, rikki cattermole wrote:
[...]
Not sure what you meant? This definitely does not error out:
https://godbolt.org/g/PAiFPw
```D
@named:
int
On Monday, 4 June 2018 at 05:46:04 UTC, rikki cattermole wrote:
On 04/06/2018 5:01 PM, Mike Parker wrote:
Named arguments lite
I'm concerned about this DIP (keep in mind I wrote a referenced
WIP DIP).
1. Reordering of parameters that match (with overloads)
```D
int add(int a, int b);
int
On Tuesday, 29 May 2018 at 12:37:04 UTC, Vijay Nayar wrote:
On Tuesday, 29 May 2018 at 11:36:11 UTC, Yuxuan Shui wrote:
No, wait a second. (a)=>a is in default argument list, so it
is in the global scope. And it was instantiated when you
instantiate BTree with char.
Could you explain that
On Tuesday, 29 May 2018 at 11:34:03 UTC, Yuxuan Shui wrote:
On Saturday, 26 May 2018 at 11:56:30 UTC, Vijay Nayar wrote:
I've been experimenting with code that uses std.functional :
binaryFun and unaryFun, but I have found that using these
methods makes it impossible to add function attributes
On Saturday, 26 May 2018 at 11:56:30 UTC, Vijay Nayar wrote:
I've been experimenting with code that uses std.functional :
binaryFun and unaryFun, but I have found that using these
methods makes it impossible to add function attributes like
@safe, @nogc, pure, and nothrow, because no guarantee
I've been using Swift in the past few years quite a bit, and it
always amuses me when it can't figure out some kind of
inference that seems trivial, but it just gives up because the
compiler takes too long to determine: "This [one line]
statement is too difficult, please split into multiple
My response below might be a little off-topic.
On Monday, 21 May 2018 at 13:06:14 UTC, Steven Schveighoffer
wrote:
[snip]
There is something to be said for keeping the compiler dumb:
1. Dumb is easy to implement, explain, and understand -- if you
set the bar low then more compilers will be
On Sunday, 20 May 2018 at 14:39:28 UTC, Jonathan M Davis wrote:
Well, constructors are one of the few places that the compiler
attempts flow analysis for stuff other than optimization,
because it pretty much has to in order to do what the language
needs. And no, it's not very sophisticated
On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote:
because it tends to become very difficult to get right in all
cases and results in situations where the programmer is forced
to do something in order to make the compiler shut up
Well, doesn't this post show exactly this problem,
On Thursday, 17 May 2018 at 20:32:23 UTC, Steven Schveighoffer
wrote:
On 5/17/18 4:25 PM, DarkHole wrote:
On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer
wrote:
On 5/17/18 3:55 PM, DarkHole wrote:
This strange code - https://run.dlang.io/is/BKgv49 - fails
with error "Error:
On Tuesday, 15 May 2018 at 13:59:37 UTC, jmh530 wrote:
On Tuesday, 15 May 2018 at 13:16:21 UTC, Steven Schveighoffer
wrote:
[snip]
Hm... neat idea. Somehow, opDispatch can probably be used to
make this work even more generically (untested):
struct WithAlloc(alias alloc)
{
auto
On Friday, 11 May 2018 at 18:55:03 UTC, Meta wrote:
On Friday, 11 May 2018 at 15:03:41 UTC, Uknown wrote:
[...]
It's not as pretty, and I don't know if it works outside this
toy example yet, but you can do:
import std.stdio;
struct Allocator
{
auto call(alias F, Args...)(Args args)
On Thursday, 10 May 2018 at 15:15:03 UTC, Paul Backus wrote:
On Thursday, 10 May 2018 at 14:37:00 UTC, rikki cattermole
wrote:
On 11/05/2018 2:33 AM, Yuxuan Shui wrote:
On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote:
But doing it with default argument expansion saves you 1
allocation,
On Thursday, 10 May 2018 at 14:30:49 UTC, Seb wrote:
On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote:
So in D I can use default argument like this:
int f(int line=__LINE__) {}
[...]
Why not define a TLS or global variable like theAllocator?
Or if you know it at compile-time as
On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote:
On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote:
[...]
For things like this you can use the OOP Factory pattern,
pseudocode:
class DataStructureFactory
{
this(Allocator alloc)
{
this.alloc = alloc;
}
Allocator
On Thursday, 10 May 2018 at 14:17:50 UTC, rikki cattermole wrote:
On 11/05/2018 2:15 AM, Yuxuan Shui wrote:
[...]
Bad idea, too much magic.
This magic is already there in D. I just want to use it in a
different way.
So in D I can use default argument like this:
int f(int line=__LINE__) {}
And because default argument is expanded at call site, f() will
be called with the line number of the call site.
This is a really clever feature, and I think a similar feature
can be useful in other ways.
Say I need
On Wednesday, 9 May 2018 at 00:58:51 UTC, jmh530 wrote:
On Tuesday, 8 May 2018 at 22:31:10 UTC, Yuxuan Shui wrote:
snip]
This doesn't compile for me on run.dlang.io:
onlineapp.d(22): Error: template onlineapp.f cannot deduce
function from argument types !()(B), candidates are:
After watching the DConf 2018 video, I came up with this wild
idea:
auto f(T)(immutable T a) {
// If T is a aggregate type, and I only use (directly
// or indirectly) the immutable fields of T,
// Then it should be OK to call f() with a partially mutable
type
return a.x+1;
}
On Tuesday, 13 March 2018 at 14:40:21 UTC, Steven Schveighoffer
wrote:
On 3/13/18 10:25 AM, Yuxuan Shui wrote:
[...]
This has been discussed before. There are a few ways around
this. One is to do what you did. Another is to append a
sentinel, or use id to terminate the loop:
foreach(id,
See this simple example:
int staticFind(T, S...)() {
foreach(id, R; S) {
if (is(T == R))
return id;
}
}
return -1;
}
staticFind!(int, int, double) will generate a 'statement is
unreachable' warning, and staticFind!(int, double) won't.
This behaviour is
On Thursday, 1 March 2018 at 17:48:02 UTC, Simen Kjærås wrote:
On Thursday, 1 March 2018 at 16:46:30 UTC, Yuxuan Shui wrote:
[...]
string TemplateStringOf(T...)()
if (T.length == 1)
{
import std.traits : TemplateOf, TemplateArgsOf;
import std.meta : AliasSeq, staticMap;
import
On Thursday, 1 March 2018 at 16:46:30 UTC, Yuxuan Shui wrote:
On Wednesday, 28 February 2018 at 15:49:25 UTC, aliak wrote:
On Wednesday, 28 February 2018 at 15:09:56 UTC, Yuxuan Shui
wrote:
For a template instantiation expression like A!(B, C!(D, E)),
I want to get a string "A!(B, C!(D, E))",
On Wednesday, 28 February 2018 at 15:49:25 UTC, aliak wrote:
On Wednesday, 28 February 2018 at 15:09:56 UTC, Yuxuan Shui
wrote:
For a template instantiation expression like A!(B, C!(D, E)),
I want to get a string "A!(B, C!(D, E))", better if A, B, C,
D, E is replaced by fully qualified name.
For a template instantiation expression like A!(B, C!(D, E)), I
want to get a string "A!(B, C!(D, E))", better if A, B, C, D, E
is replaced by fully qualified name.
Is this possible?
On Sunday, 17 December 2017 at 12:45:58 UTC, Yuxuan Shui wrote:
However, going through sections_elf_shared.d, it makes me feel
it's doing some magic tricks with dl functions, but I don't
know what for?
Looks like it's also repeating some work that is already done by
the dynamic linker...
I'm trying to get dmd and phobos working with musl. Right now I
have a bootstrapped compiler built with musl, which seems to work
fine. However user applications will segmentation fault before
even reaches main.
I investigated a bit. Looks like musl is not happy with how
druntime uses dlopen
On Tuesday, 17 May 2016 at 08:51:01 UTC, Jacob Carlborg wrote:
As an alternative to glibc there's a C standard library called
musl [1]. This is the C standard library used by ELLCC [2], a
cross-compiler based on Clang. This cross-compiler makes it
very easy to target other platforms and can be
On Wednesday, 1 November 2017 at 01:16:32 UTC, solidstate1991
wrote:
After I started to alter my graphics engine to use the multiple
kinds of bitmaps (now using multiple language features, like
templates and aliases) on one layer, I noticed that type
detection of bitmap objects would be easier
On Sunday, 10 September 2017 at 14:42:42 UTC, Moritz Maxeiner
wrote:
On Sunday, 10 September 2017 at 14:04:20 UTC, rikki cattermole
wrote:
On 10/09/2017 2:19 PM, Moritz Maxeiner wrote:
If TypeInfo for extern(C++) classes is removed, couldn't
final extern(C++) classes without base class and
By the way, can we dynamic_cast extern(C++) classes in C++? If
not, what are we generating these TypeInfo_Class for?
On Sunday, 10 September 2017 at 09:31:55 UTC, Walter Bright wrote:
On 9/10/2017 1:40 AM, Yuxuan Shui wrote:
I was experimenting with -betterC and found out that C++
classes doesn't work. Because the resulting object file needs
a symbol "_D14TypeInfo_Class6__vtblZ" which is in druntime. I
I was experimenting with -betterC and found out that C++ classes
doesn't work. Because the resulting object file needs a symbol
"_D14TypeInfo_Class6__vtblZ" which is in druntime. I suppose this
is to support T.classinfo?
Could we remove T.classinfo and make classes work under -betterC?
Or is
On Friday, 1 September 2017 at 14:03:26 UTC, Martin Nowak wrote:
Glad to announce D 2.076.0.
This release comes with static foreach, many -betterC
enhancements, various phobos additions, an -mcpu=avx2 switch,
and lots of bugfixes.
Thanks to everyone involved in this .
On Friday, 11 August 2017 at 18:44:56 UTC, bitwise wrote:
struct S {
static int count = 0;
this(int x) { ++count; }
this(this) { ++count; }
~this() { --count; }
}
int main(string[] argv)
{
S[] x = [S(1), S(1)];
writeln("GC allocated: ", (GC.addrOf(x.ptr) !is null));
On Tuesday, 1 August 2017 at 22:06:28 UTC, Walter Bright wrote:
On 7/31/2017 5:41 AM, Joakim wrote:
If he's right that C++ use is so balkanized, this will
simplify some code but further balkanize the language. That
might be worth it for them, but rather than simplifying the
language, it
Someone made an interesting proposal to C++:
https://herbsutter.files.wordpress.com/2017/07/p0707r1.pdf
Thoughts?
On Wednesday, 19 July 2017 at 10:35:37 UTC, Stefan Koch wrote:
On Wednesday, 19 July 2017 at 10:24:35 UTC, Marc Schütz wrote:
On Sunday, 16 July 2017 at 20:44:13 UTC, Andrei Alexandrescu
wrote:
Perhaps we go the inverse route and define the bottom type as
typeof(*null). Would that simplify
On Tuesday, 18 July 2017 at 15:26:59 UTC, Timon Gehr wrote:
On 18.07.2017 14:19, Stefan Koch wrote:
[...]
D has a C-inspired first-order type system, so it is not
necessarily crucial to have it in D. (The reason I got involved
in this thread is that it was proposed to add Bottom as a type
On Wednesday, 31 May 2017 at 09:31:48 UTC, Jonathan M Davis wrote:
On Wednesday, May 31, 2017 08:18:07 Vasileios Anagnostopoulos
via Digitalmars-d-learn wrote:
[...]
Well, if you're not doing checked exceptions, the interesting
question is really what _doesn't_ throw rather than what
On Wednesday, 31 May 2017 at 08:18:07 UTC, Vasileios
Anagnostopoulos wrote:
Hi,
after reading various articles bout the "supposed" drawbacks of
checked exceptions I started to have questions on @nothrow. Why
there exists and not a @throws annotation enforced by the
compiler? I understand
On Sunday, 4 June 2017 at 04:39:21 UTC, Adam D. Ruppe wrote:
On Sunday, 4 June 2017 at 04:34:44 UTC, Mike Parker wrote:
I would not have expected enum b = sort(a) to trigger an
allocation. auto b, yes, of course (and the disassembly from
that is not much different). So I'd love to see a blog
On Tuesday, 16 May 2017 at 01:34:50 UTC, Stanislav Blinov wrote:
On Tuesday, 16 May 2017 at 01:22:49 UTC, Yuxuan Shui wrote:
Can I expand an array with uninitialized object? Or can I rely
on the compiler to optimize the initialization away?
Built-in arrays always default-initialize their
On Monday, 15 May 2017 at 23:36:06 UTC, Stanislav Blinov wrote:
On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote:
Suppose I have a
struct A {
@disable this(this);
} x;
How do I append it into an array?
Do I have to do
array.length++;
moveEmplace(x, array[$-1]);
?
moveEmplace
Suppose I have a
struct A {
@disable this(this);
} x;
How do I append it into an array?
Do I have to do
array.length++;
moveEmplace(x, array[$-1]);
?
So in this document:
http://yshui.gitlab.io/sdpc/sdpc/parsers/whitespace.html
Part of the type name is still mangled. I found ddox use
core.demangle.demangleType internally. So I guess code.demangle
is following behind dmd?
Is there a better way to demangle a name?
On Saturday, 13 May 2017 at 00:59:14 UTC, Stanislav Blinov wrote:
On Saturday, 13 May 2017 at 00:36:55 UTC, mogu wrote:
```d
if (null)
"1".writeln;
if ("")
"2".writeln;
if ("" == null)
"3".writeln;
```
Output:
2
3
How to understand this?
Boolean conversion on an array works on
I wondered if I can turn struct that defines opApply into ranges.
And it turns out to be surprisingly easy:
https://gist.github.com/yshui/716cfe987c89997760cabc2c951ca430
Maybe we can phase out opApply support in foreach? ;)
BTW, is there a way to get the "element type" from .opApply?
On Tuesday, 9 May 2017 at 13:19:09 UTC, Timon Gehr wrote:
On 07.05.2017 19:03, Stanislav Blinov wrote:
On Sunday, 7 May 2017 at 16:57:58 UTC, Andrei Alexandrescu
wrote:
[...]
I see only unsurprising Jpeg artifacts and not much more :)
It's too low resolution to make anything out.
It's
Code:
@safe auto id(scope int *p) {
int*[] a;
a ~= p;
return a;
}
@safe int *bar() {
int i;
return id()[0]; //pointer to local escaped
}
Compiles with -dip1000
On Thursday, 6 April 2017 at 18:45:26 UTC, Ali Çehreli wrote:
On 04/06/2017 11:37 AM, Russel Winder via Digitalmars-d-learn
wrote:
[...]
I think it's just a design choice. C implicitly converts the
name of the function to a pointer to that function. D requires
the explicit & operator:
On Wednesday, 5 April 2017 at 16:06:39 UTC, H. S. Teoh wrote:
On Wed, Apr 05, 2017 at 11:20:28AM +, Yuxuan Shui via
Digitalmars-d wrote:
[...]
Did you read the entire article?
There is an entire section dedicated to interleaving of CTFE
and templates. And no, you still cannot run CTFE
On Sunday, 2 April 2017 at 04:34:34 UTC, H. S. Teoh wrote:
On Sat, Apr 01, 2017 at 05:06:14PM +, Inquie via
Digitalmars-d wrote: [...]
How far off until newCTFE is usable to compile the majority of
templates out there?
CTFE and templates are two separate things. You may want to
read this
On Sunday, 26 March 2017 at 17:55:20 UTC, Nick Sabalausky
(Abscissa) wrote:
2. Maybe the std.random docs need to be more clear, right up
top, that it's not for anything security-related.
Agreed. Like what Python did here:
https://docs.python.org/3/library/random.html
On Saturday, 25 March 2017 at 05:20:44 UTC, Jonathan M Davis
wrote:
On Saturday, March 25, 2017 04:57:26 Yuxuan Shui via
Digitalmars-d-learn wrote:
[...]
An AliasSeq isn't really ever a type. AliasSeq!(int, float) is
a list of types, not a type itself, and is expressions supports
comparing
On Saturday, 25 March 2017 at 04:23:31 UTC, Jonathan M Davis
wrote:
On Saturday, March 25, 2017 03:25:27 Yuxuan Shui via
Digitalmars-d-learn wrote:
In this example:
import std.range;
template expandRange(alias R) if
(isInputRange!(typeof(R))) {
static if (R.empty
In this example:
import std.range;
template expandRange(alias R) if (isInputRange!(typeof(R))) {
static if (R.empty)
alias expandRange = AliasSeq!();
else
alias expandRange = AliasSeq!(R.front(),
expandRange!(R.drop(1)));
}
///
unittest {
On Friday, 24 March 2017 at 20:43:18 UTC, Dmitry Olshansky wrote:
On 3/24/17 12:24 AM, Yuxuan Shui wrote:
So I was trying to make my template take a value parameter,
whose type
is also a parameter to the template. e.g.:
template A(Char[] str, Char);
But dmd complains about 'Char' being
On Friday, 24 March 2017 at 17:53:14 UTC, Basile B. wrote:
On Thursday, 23 March 2017 at 22:55:10 UTC, Yuxuan Shui wrote:
[...]
Thanks for sharing this but your project is not visible!
Gitlab is a bit confusing because by default repositories are
private. Go to your project setting(should
So I was trying to make my template take a value parameter, whose
type is also a parameter to the template. e.g.:
template A(Char[] str, Char);
But dmd complains about 'Char' being undefined. I have to write:
template A(Char, Char[] str);
Which is inconvenient, because now 'Char'
BTW, ddox cleanly has some problem with this symbol:
https://yshui.gitlab.io/sdpc/sdpc/parsers/skip_whitespace.html
GitLab: https://gitlab.com/yshui/sdpc
Documents: https://yshui.gitlab.io/sdpc
Dub: http://code.dlang.org/packages/sdpc
I started this project ~1.8 years ago. It only took me a couple
of weeks to write, and I learned a lot about D's template system
(and its limitations) by writing it. But back
Hi,
Is there any difference, when a type is passed into an alias
parameter vs into a type parameter?
On Tuesday, 21 March 2017 at 01:10:38 UTC, Jonathan M Davis wrote:
On Monday, March 20, 2017 22:14:37 Yuxuan Shui via
Digitalmars-d wrote:
On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis
wrote:
> [...]
Makes sense...
OK, attempt 2: how about support implicit partial applicat
On Monday, 20 March 2017 at 21:53:47 UTC, Jonathan M Davis wrote:
On Monday, March 20, 2017 21:37:26 Yuxuan Shui via
Digitalmars-d wrote:
[...]
auto ref for non-templates would not be quite the same thing,
and regardless, it wouldn't help any with explictly
instantiating a template that had
On Monday, 20 March 2017 at 21:34:14 UTC, Yuxuan Shui wrote:
On Monday, 20 March 2017 at 21:08:40 UTC, Jonathan M Davis
wrote:
[...]
This is a bit tedious because it requires you creating a new
function.
Maybe we can create a template for that. But still, auto ref
requires us to do things
On Monday, 20 March 2017 at 21:08:40 UTC, Jonathan M Davis wrote:
On Monday, March 20, 2017 13:20:52 Jonathan M Davis via
Digitalmars-d wrote:
So, yes, this particular restriction can be annoying, but
there is a good reason for the restriction (though the error
message _is_ pretty bad), and I
On Monday, 20 March 2017 at 19:49:03 UTC, Yuxuan Shui wrote:
And you can't do that with an auto ref template, which makes
them quite annoying.
BTW, the error message you get when you try to do this, is not
very helpful:
'auto' can only be used as part of 'auto ref' for template
function
An auto ref function template should behave like a normal
function template, but it doesn't.
You can fully instantiate a function template by specifying all
of its template parameters, but you can't do that with auto ref
templates. The only way to instantiate an auto ref template is to
call
auto a(T)(auto ref T t) {
return t;
}
void main() {
alias tmp = a!int;
import std.stdio;
writeln(tmp(10));
}
This gives this error message:
test.d(1): Error: 'auto' can only be used as part of 'auto ref'
for template function parameters
Which is rather useless,
On Wednesday, 15 March 2017 at 22:07:26 UTC, Bastiaan Veelo wrote:
On Wednesday, 15 March 2017 at 14:06:23 UTC, Yuxuan Shui wrote:
So someone already wrote a parser combinator for D?
I searched code.dlang.org (1.5 years ago?), and there was
none, so I wasted couple weeks writing my own
On Tuesday, 14 March 2017 at 20:16:34 UTC, Ali Çehreli wrote:
On 03/14/2017 09:35 AM, Moritz Maxeiner wrote:
On Tuesday, 14 March 2017 at 16:12:56 UTC, Mike Parker wrote:
Fresh from the D Foundation HQ, the DConf 2017 schedule [1]
is now
available for your perusal. If you haven't registered
1 - 100 of 289 matches
Mail list logo