On Wednesday, 9 May 2018 at 10:16:22 UTC, Melvin wrote:
class SomeNode : GodotScript!Node
{
@Signal void testSignal(float a, long b);
// The declaration above would trigger the generation of
this line
void testSignal(float a, long b) {
owner.emitSignal("testSignal", a, b); }
On Friday, 27 April 2018 at 13:27:45 UTC, Timoses wrote:
Bumped across another problem : /
```
import std.stdio;
enum menum { A, B, C }
void main()
{
foo(menum.A);
}
void foo(menum e)
{
writeln(instantiateWith!Temp(e));
}
auto instantiateWith(alias Fn, T)(T x)
if (is(T == enum))
On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote:
How can I use the following c structure from d.
struct Item
{
int id;
};
struct Group
{
int i;
int item_count;
struct Item items[];
};
tried defining items[] as both "Item[] items" and "Item* items"
in d, it compiles okay but
On Saturday, 19 May 2018 at 18:44:42 UTC, IntegratedDimensions
wrote:
On Saturday, 19 May 2018 at 18:19:35 UTC, IntegratedDimensions
wrote:
Is there any way to create an int24 type that behaves just
like any other built in type without having to reimplement
everything?
In fact, what I'd like
On Thursday, 24 May 2018 at 07:47:54 UTC, Andrea Fontana wrote:
Is this a bug or am I missing something?
https://run.dlang.io/is/OGHJYX
Andrea
This line:
mixin("alias tmp = " ~ s ~ ";");
There's no mention of Symbol in there. If you change it to this:
mixin("alias tmp =
On Tuesday, 12 June 2018 at 11:04:40 UTC, bauss wrote:
[snip]
void test(T)()
{
pragma(msg, (getBar!T).baz());
pragma(msg, (getBar!T).helloworld());
import std.stdio;
mixin((getBar!T).baz());
mixin((getBar!T).helloworld());
}
[snip]
Is there a way to avoid having to write
On Friday, 15 June 2018 at 10:53:35 UTC, uknys wrote:
On Friday, 15 June 2018 at 07:27:22 UTC, Simen Kjærås wrote:
[snip]
Yeah I saw that Algebraic doesn't work at compile time, then I
thought of using an Interface with one function (execute()) and
making Hello and Toto as classes
On Thursday, 14 June 2018 at 19:15:38 UTC, uknys wrote:
Hello,
I wanted to know if such code was possible :
alias Operation = Algebraic!(/* All type that implements X UDA
*/)
struct X
{
int opcode;
Operation h;
}
@X(0x01, Hello(3))
@X(0x02, Hello(4))
struct Hello
{
int Hello;
}
On Tuesday, 29 May 2018 at 21:19:01 UTC, DigitalDesigns wrote:
https://dpaste.dzfl.pl/67691db19ce8
Simplified:
interface A
{
import std.meta : AliasSeq;
alias a = AliasSeq!(__traits(getMember, B, "foo"));
void foo();
}
class B : A
{
void foo() { }
}
It seems the compiler is
On Wednesday, 30 May 2018 at 09:58:16 UTC, biocyberman wrote:
How do I add logging for this struct?
https://run.dlang.io/is/9N6N4o
If not possible, what's the alternative?
This line:
writeln("got num: %s, of type: %s", num, typeof(num));
Gives this error message:
onlineapp.d(7):
On Monday, 28 May 2018 at 20:13:49 UTC, DigitalDesigns wrote:
I do not think this is a problem in D. Infinite recursion can
always be terminated with appropriate means.
1. Use attributes. methods in class A should be marked as being
for the interface. When added to the interface they will not
On Sunday, 3 June 2018 at 14:57:37 UTC, DigitalDesigns wrote:
On Sunday, 3 June 2018 at 09:52:01 UTC, Malte wrote:
You might want to have a look at
https://wiki.dlang.org/Dynamic_typing
This sounds very similar to what you are doing. I never really
looked into it, because I prefer to know
On Tuesday, 5 June 2018 at 09:36:22 UTC, Gopan wrote:
void main()
{
immutable n = __ctfe ? 1 : 2;
int[n] a;
assert(a.length == n); // fails, wat
}
That's gotta be a bug - that should give a 'variable n cannot be
read at compile time' error. The fact that n is immutable
shouldn't
On Wednesday, 6 June 2018 at 06:25:49 UTC, DaggetJones wrote:
Hi, I'm wondering how I should approach supplying
functions/delegates around in D. I have option of using classes
where the function exists inside the class and to provide
different functionality different classes are created.
On Sunday, 27 May 2018 at 17:42:15 UTC, Sobaya wrote:
I'd like to get symbols that have an UDA.
But when the member is private, it is not obtained.
And I found a comment saying "Filtering inaccessible members"
in the source.
Why is it necessary to filter out private members?
Since the
On Monday, 28 May 2018 at 09:59:50 UTC, DigitalDesigns wrote:
Implementing interfaces can be a pain but are necessary.
I like to use abstract classes and provide a base
implementation. It would be cool if I could use D's awesome
meta features to extract the interface from the abstract class
On Saturday, 2 June 2018 at 22:09:49 UTC, Neia Neutuladh wrote:
On Saturday, 2 June 2018 at 21:44:39 UTC, greatsam4sure wrote:
Sorry for the typo
is it possible to define infix function in D
3.min(5)// 3: where min is a function, works in D
3 min 5 // does not work.
thanks in advance
This
On Sunday, 1 July 2018 at 09:46:55 UTC, Timoses wrote:
Would be nice if std.meta.ApplyLeft did the job here.. Is there
no way of achieving that?
[snip]
Would have to find a way to determine whether Template would
resolve to a function or not. Can't find anything in Traits[1]
or std.traits[2].
On Sunday, 1 July 2018 at 22:04:05 UTC, Robert M. Münch wrote:
On 2018-07-01 09:05:56 +, Robert M. Münch said:
This one look nasty...
And it was... the problem was, that I kept D allocated pointers
in C code without informing the GC that the memory can't be
collected nor moved.
On Monday, 25 June 2018 at 09:36:45 UTC, Martin Tschierschke
wrote:
I am not sure that I understood it right, but there is a way to
detect the status of a parameter:
My question was different, but I wished to get a ctRegex! or
regex used depending on the expression:
import
On Saturday, 30 June 2018 at 21:11:54 UTC, Anonymouse wrote:
I have a template that I want to provide easy aliases for,
where the aliases includes (partially applies?) a template
parameter.
void fooImpl(char token, T)(const T line)
{
// ...
}
alias quoteFoo(T) = fooImpl!('"', T);
alias
On Thursday, 26 April 2018 at 16:10:16 UTC, Timoses wrote:
Is it possible to use a template to place the "static foreach"
looping to find the correct enum value into? Like I am trying
in the initial "draft" GetMenum?
As the compiler says, the value of `e` is not known at
compile-time. In
On Thursday, 11 January 2018 at 12:32:54 UTC, Per Nordlöw wrote:
Is this an ok implementation:
enum bool isNogc(alias fun) = (isCallable!fun &&
(functionAttributes!fun &
FunctionAttribute.nogc));
@safe pure nothrow @nogc unittest
{
On Thursday, 11 January 2018 at 11:21:08 UTC, tipdbmp wrote:
string push_stuff(char[] buf, int x) {
if (x == 1) {
buf ~= 'A';
buf ~= 'B';
buf ~= 'C';
return cast(string) buf[0 .. 3];
}
else {
buf ~= 'A';
buf ~= 'B';
return
On Thursday, 11 January 2018 at 08:59:01 UTC, Chirs Forest wrote:
I'm using std.variant.Variant to hold a value of unknown type
(not a string, could be a numeric type or a container holding
multiple numeric types). I'm trying to retrieve this value with
.get!T but I need the type to do that...
On Thursday, 4 January 2018 at 15:50:35 UTC, Vino wrote:
Hi All,
Request your help, on how o find the single type of a tuple
return type function, eg,
auto Fn (){
Array!string a;
Array!int b;
Array!ulong c;
return tuple(a, b, c);
}
if we use "ReturnType!Fn" it gives us the output as
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any
value for regular foreach over compile-time sequences?
There is, as far as I've seen, there's nothing old
foreach-over-tuple can do that new-style static foreach can't.
On Monday, 15 January 2018 at 13:55:57 UTC, Nordlöw wrote:
Why do I get errors like
template instance remove!((_) => _ == 1) cannot use local
'__lambda5' as parameter to non-global template remove()(in K
key)
for
x.remove!(_ => _ == 1);
but not for
x.remove!"a == 11";
?
How are
On Monday, 15 January 2018 at 15:24:50 UTC, Marc wrote:
I just thought that filter() could be evaluated at compile time
too, as others function that I've used so far. Sometimes I
don't know if a native function can be evaluated at compile
time until I do enum x = func();
Yeah, it takes some
On Friday, 19 January 2018 at 11:02:01 UTC, tipdbmp wrote:
The following seems to work in C++, but errors in D, why is
that?
int foo(int* num) {
{
static int x = 10;
x += 1;
*num += x;
}
{
static int x = 20; // error: foo.x is already defined
in
On Saturday, 20 January 2018 at 14:31:59 UTC, Sobaya wrote:
How can I wrap function whose arguments contain both ref and
normal like 'func' ?
With normal 'Args', x is not increased because x is copied when
passed to opDispatch.
If I write 'ref Args' in opDispatch's argument, it fails
because
On Sunday, 14 January 2018 at 22:07:22 UTC, Marc wrote:
thanks, can i use it at compile time as well?
enum isMutableString(string field) =
is(typeof(__traits(getMember, >C, field)) == string);
static foreach(field; [FieldNameTuple!C].filter!(f =>
isMutableString!(f))) {
On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote:
Hi, so basically is there a way to:
void func(alias pred = null, Range)(Range range) {
// 1) check if pred(ElementType!Range.init,
ElementType!Range.init) is equality
// 2) check if isUnary!pred
// 3) check if isBinary!pred
}
On Friday, 26 January 2018 at 14:16:04 UTC, aliak wrote:
It basically steps through in a stride and sets the checkpoints
to false.
C++:
template N>
void mark(It begin, It end, N step) {
assert(begin != end)
*begin = false;
while (end - begin > step) {
begin = begin + step;
On Friday, 26 January 2018 at 20:08:19 UTC, Dechcaudron wrote:
So I'm trying to get this to compile:
```
static foreach (alias member; getSymbolsByUDA!(typeof(this),
Serialize))
serializeMember!member(bundle);
```
And I'm getting the following error: value of 'this' is not
On Friday, 26 January 2018 at 15:33:03 UTC, aliak wrote:
On Friday, 26 January 2018 at 14:35:25 UTC, Meta wrote:
On Friday, 26 January 2018 at 14:16:04 UTC, aliak wrote:
1) I've seen some phobos code checking for assignability like
this:
is(typeof(range.front = false))
... is that an
On Friday, 26 January 2018 at 20:43:05 UTC, Fra Mecca wrote:
What should I do now?
I am undecided between:
- commenting on the bug tracker and close the bug
- link the pr 6056 on the bug tracker
- leaving it be
Leaving a comment on the bug with a link to the PR, and marking
the bug resolved
On Tuesday, 30 January 2018 at 14:01:00 UTC, bauss wrote:
unittest {
auto a = foo(); // This should fail, because a is
never used.
No it shouldn't. It is assigned to a variable, as the constraint
said.
// This should also fail, because b is never used actually
used
On Tuesday, 30 January 2018 at 17:41:53 UTC, jsako wrote:
So what's considered the best alternative to void pointers in D
if you don't want to use objects? Make a tagged Union of all
possible datatypes in the struct? Have a Byte array and cast
that instead of a void pointer? Some sort of magic
On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote:
.headConst
.headMutable. :p Head-const is something we generally want to
avoid.
--
Simen
On Thursday, 1 February 2018 at 11:51:11 UTC, aliak wrote:
Is there a way to do this:
import std.stdio;
void main()
{
alias f = (a) => (b) => a * b;
f(2)(3).writeln;
}
The problem here is the outer lambda doesn't know what type the
inner lambda is. We can rewrite this a bit:
auto
On Monday, 29 January 2018 at 09:23:55 UTC, Sobaya wrote:
I found a strange behavior.
class A {
void opAssign(int v) {}
}
class Test {
A a;
this() {
a = new A(); // removing this causes compile error.
a = 3; // cannot implicitly convert expression `3` of
`int` to
On Monday, 29 January 2018 at 11:36:26 UTC, aliak wrote:
You don't want to mutate const elements anyway. It would be
breaking a promise that other parts of the program may be
depending on. I would return a filtered-out range:
Right, I want to mutate the range though, not the elements. So
On Thursday, 1 February 2018 at 18:58:15 UTC, H. S. Teoh wrote:
However, if we go back to the idea of tail-const, we could
potentially eliminate the need for casts and also avoid
breaking immutable. Basically, the problem with writing
const(RefCounted!T) is that it's a one-way street: on the
On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote:
I haven't thought through it carefully, but if .headConst is a
viable solution to the head-const problem, then conceivably we
could also extend it to deal with immutable payloads too. Then
we could go from, say,
Is there a way to get a compile error when returning a temporary
from a function and then not assigning it to a variable or
passing it to a different function? E.g:
struct S {
int[] a;
void morph() {}
}
@warnOnDiscard
S foo() {
return S([1,2,3]);
}
unittest {
auto a = foo();
On Tuesday, 30 January 2018 at 11:36:25 UTC, Jonathan M Davis
wrote:
[nope]
Thanks. It's what I thought, though not what I wanted.
IIRC, the Weka guys wanted to be able to have attributes tell
the compiler stuff so that it could yell at the programmer when
appropriate, so I think that there
On Friday, 2 February 2018 at 14:29:34 UTC, H. S. Teoh wrote:
Its semantics are not broken; it's just harder to use. Due to
const transitivity, it's an all-or-nothing deal. .tailConst
gives us the middle ground.
If the semantics of const means that users will have to write
.tailConst all
On Monday, 12 February 2018 at 09:10:52 UTC, Alex wrote:
A more extreme example: You have a compiled library, and some
.di (header) files. In one of those files is this code:
struct S {
static int[] arr;
void foo();
}
Now how should Typedef go about making foo() do the right
thing?
On Monday, 12 February 2018 at 09:58:13 UTC, Alex wrote:
On Monday, 12 February 2018 at 09:37:56 UTC, Simen Kjærås wrote:
Not really, since D doesn't have a concept of an address
associated with a type, only with instances of it. So when you
use a static array, the address is hard-coded.
On Sunday, 11 February 2018 at 19:33:23 UTC, Alex wrote:
On Sunday, 11 February 2018 at 15:18:11 UTC, Simen Kjærås wrote:
Basically, Typedef looks like this:
struct Typedef(T) {
T _payload;
// Forward method calls, member access, etc, to _payload.
}
If T looks like this:
struct T {
On Monday, 12 February 2018 at 08:35:05 UTC, Nathan S. wrote:
For example in std.container.rbtree:
---
auto equalRange(this This)(Elem e)
{
auto beg = _firstGreaterEqual(e);
alias RangeType = RBRange!(typeof(beg));
if (beg is _end || _less(e, beg.value))
On Saturday, 10 February 2018 at 13:18:28 UTC, Alex wrote:
Do I overlook something?
/// --- code --- ///
import std.typecons;
void main(){}
static assert(!__traits( compiles, E()));
static assert(!__traits( compiles, MyE())); // line 6
struct E
{
size_t dummy;
@disable
On Sunday, 11 February 2018 at 01:32:52 UTC, Alex wrote:
On Saturday, 10 February 2018 at 02:55:26 UTC, Alex wrote:
bug filed
https://issues.dlang.org/show_bug.cgi?id=18416
Basically, Typedef looks like this:
struct Typedef(T) {
T _payload;
// Forward method calls, member access,
On Wednesday, 21 February 2018 at 06:45:14 UTC, thorstein wrote:
Hi,
I'm going circles... ;) I read a string that contains an array
of unknown dimension like:
a = [1,2,3,4] or
a = [[1,2],[3,4]] or
a = [[[1,2],[3,4]],[[5,6],[7,8]]]
With that I want to perform specified operations e.g. also
On Wednesday, 21 February 2018 at 14:11:10 UTC, ParticlePeter
wrote:
struct Foo(T) {
T bar;
this(S)(S s) {
bar = convert(s);
}
}
auto foo = Foo!int(some_float);
this works because S is deduced as typeof(some_float), but how
would I instantiate the struct without relying on auto
On Wednesday, 21 February 2018 at 14:29:38 UTC, ixid wrote:
I do not understand what is happening here, I tried to wrote
what I thought would be the answer. If someone could explain
that would be great. I wrote this code:
struct Foo2(T, S) {
T bar;
this(S s) {
bar = s.to!T;
}
}
On Monday, 19 February 2018 at 12:58:45 UTC, Marc wrote:
I'm pretty sure something could be done with Ada's type range
but what we could do using D?
We can easily define a range type in D. The simple example below
probably has awful performance and many holes, but outlines the
basic idea. It
On Tuesday, 20 February 2018 at 14:34:53 UTC, bauss wrote:
Would there be a reason why this wouldn't be a good
implementation?
What is the intended use case for this? The main feature seems to
be an ability to have read-only members, which is nice. Are there
other benefits?
If so what
On Monday, 19 February 2018 at 13:33:34 UTC, rikki cattermole
wrote:
https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min
Can't seem to get that to work, so I assumed it's not meant to be
used that way:
import std.experimental.checkedint;
struct MyHook {
enum min(T) =
On Monday, 19 February 2018 at 14:20:16 UTC, Basile B. wrote:
I had never used Checked and i discover that strangely there's
no hook for opAssign. onLowerBound and onUpperBound works for
+=, -=, *=, /=, %=, ^^=, &=, |=, ^=, <<=, >>=, and >>>=. But
since init is 0, += works:
Ah, thanks. Filed
On Saturday, 30 December 2017 at 03:49:37 UTC, ChangLong wrote:
What I am try to do is implement a unique data type. (the
ownership auto moved into new handle)
Have you considered std.typecons.Unique[0]? If yes, in what ways
does it not cover your needs?
Your example code written with
On Saturday, 16 June 2018 at 05:05:19 UTC, DigitalDesigns wrote:
tupleof does not return static fields as does not Fields.
Currently the only method seems to be use allMembers, but that
returns members requiring filtering, which there is no good
filtering checks. I'd simply like to get all the
On Monday, 30 July 2018 at 18:30:16 UTC, aliak wrote:
Is this a bug?
If not is there a workaround?
I would like for the alias this to function as a normal A type
unless B specifically disables certain features, but it seems
weird that disabling one opAssign disables all of them inside
the
On Tuesday, 31 July 2018 at 20:40:25 UTC, Steven Schveighoffer
wrote:
OK, so one thing to learn in D, you can't hijack stuff. When
you override a function, you have to override ALL the overloads.
I could have sworn I tested this before I wrote that it's a bug:
struct A {
void fun(int) {}
On Monday, 30 July 2018 at 23:41:09 UTC, aliak wrote:
https://issues.dlang.org/show_bug.cgi?id=19130
Beautiful. :)
Would it take much to fix it up to use with templated opAssigns
as well?
I spent half an hour doing silly things, then I came up with this:
struct A {
void opAssign(int)
On Tuesday, 31 July 2018 at 08:28:01 UTC, Ky-Anh Huynh wrote:
Hi,
Can I define a new quick function to use inside a unittest
block?
I have the following code:
[code]
auto foo(string[] sta) {
return sta;
}
auto bar(string[] sta) {
return sta;
}
auto h(string[] sta) {
return
On Tuesday, 31 July 2018 at 07:01:33 UTC, Simen Kjærås wrote:
auto opAssign(T...)(T args)
Admittedly, one rarely uses multi-argument opAssign, but for
those rare occasions... :p
--
Simen
On Thursday, 2 August 2018 at 12:08:50 UTC, Everlast wrote:
On Thursday, 2 August 2018 at 03:20:30 UTC, Mike Parker wrote:
On Wednesday, 1 August 2018 at 20:57:30 UTC, Everlast wrote:
I can create a console for a dll using AllocConsole and
special Write functions but this is a pain. How do I
On Monday, 6 August 2018 at 19:43:17 UTC, Steven Schveighoffer
wrote:
On 8/6/18 2:59 PM, vit wrote:
struct ExprImpl(Ts...){
enum N = max(staticMap!(sizeOf, Ts));
This is clever!
No need to be clever though - we've got std.traits.Largest for
exactly this kind of purpose.
--
Simen
On Tuesday, 14 August 2018 at 09:17:41 UTC, ixid wrote:
On Tuesday, 14 August 2018 at 09:12:30 UTC, ixid wrote:
This will not compile as it says n is not known at compile
time...
This does work if 'value' is changed to immutable and fun to
accept it. So it still seems like a missed
On Friday, 10 August 2018 at 11:17:10 UTC, learnfirst1 wrote:
I think the static extern(C) nested function should just work
like global extern(C) function. DMD still report missing
symbols. Or I am wrong about this ?
template G(){
static extern(C) pragma(crt_constructor) void
On Friday, 10 August 2018 at 08:31:21 UTC, learnfirst1 wrote:
#!/usr/bin/env rdmd
import core.stdc.stdio;
template G(size_t line = __LINE__, A...){
int i = 3;
static extern(C) pragma(crt_constructor) void init2(){
printf("init: %d\n", line);
}
}
On Friday, 10 August 2018 at 09:57:53 UTC, learnfirst1 wrote:
T!(t => {
printf("test 2 name = %s\n".ptr, t.name.ptr);
}, "test") ; // build error
This is not doing what you think it's doing. The syntax t => {
return t; } is equivalent to t => () => t. That is,
On Wednesday, 8 August 2018 at 12:57:43 UTC, learnfirst1 wrote:
Why this is a error ?
```
struct S {
bool v;
string x;
}
S* add(A...)(ref A a) {
__gshared s = S(a);
return
}
void main(){
auto p = add(true);
}
```
test.d(9): Error: variable _param_0
On Wednesday, 22 August 2018 at 08:33:36 UTC, Andrey wrote:
Hello,
I know that D has build-in unit tests. If so, what mechanism D
provides for mocking objects?
For example:
struct WebParser
{
// ...
int download(string path)
{
SomeHttpClient client(path);
auto result =
On Monday, 27 August 2018 at 14:59:20 UTC, SG wrote:
On Monday, 27 August 2018 at 07:59:17 UTC, Simen Kjærås wrote:
That's the null propagation operator (?.). What SG asked for
is the null-coalescing operator (??). Of course, this can also
be implemented in D (albeit with a slight more
On Sunday, 19 August 2018 at 16:03:06 UTC, QueenSvetlana wrote:
On Sunday, 19 August 2018 at 15:53:25 UTC, Chris M. wrote:
On Sunday, 19 August 2018 at 15:49:18 UTC, Chris M. wrote:
On Sunday, 19 August 2018 at 15:44:07 UTC, QueenSvetlana
wrote:
[...]
auto appendNumber =
On Saturday, 25 August 2018 at 19:16:26 UTC, Jacob Carlborg wrote:
On 2018-08-25 15:33, SG wrote:
Hi,
1) I program in C# and I'm wondering if there is something
like ?? (Null-Coalescing Operator) in D? (I remember some
proposals in the past).
Not in the language but it can be implemented
On Wednesday, 22 August 2018 at 11:58:25 UTC, XavierAP wrote:
When I want to have the same operator overloading code in both
types however, I can't make it work:
From https://dlang.org/spec/operatoroverloading.html#binary:
"the one with the ‘better’ match is selected. It is an error for
both
On Wednesday, 22 August 2018 at 10:36:32 UTC, Andrey wrote:
Hello,
Is there a template/function/mixin... in the library that I can
use to map elements of a tuple?
object.foo(Mapper!myMapFunction(1, bool, "Qwerty",
EnumedColor.Red));
where "Mapper" is this mapper and "myMapFunction" is a
On Friday, 17 August 2018 at 08:52:53 UTC, Andrey wrote:
I mean - can I skip some arguments and set only one that I want?
Hm, Python, it seems to me, support this feature.
There's no such built-in functionality in the language or
standard library, no. As Jonathan pointed out, this has been
On Thursday, 19 July 2018 at 19:18:43 UTC, jmh530 wrote:
However, it seems like hasUDA doesn't seem to produce the
result I would have expected here. I tried using getAttributes,
but that didn't work either.
Am I missing something, or should I submit an enhancement
request?
UDAs apply to
On Monday, 16 July 2018 at 13:13:53 UTC, Timoses wrote:
On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote:
On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote:
Why does this fail?
It doesn't. Not using DMD 2.081.1 under Windows, at least. I
tried adding a bitfield since you
On Thursday, 19 July 2018 at 10:04:34 UTC, RazvanN wrote:
I just don't understand why you would ever mark the destructor
of a struct with @disable. When is that useful? If it's not,
why not just forbit it?
struct S1 {
~this() { /* stuff */ }
}
struct S2 {
S1 s;
@disable ~this();
On Wednesday, 18 July 2018 at 11:28:54 UTC, Timoses wrote:
But why is a context pointer a problem? Is it problematic
because the context pointer to the main scope can not guarantee
`immutable`? E.g. if I happened to use data from main in a
function of the immutable struct then... well then
On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote:
Why does this fail?
It doesn't. Not using DMD 2.081.1 under Windows, at least. I
tried adding a bitfield since you mentioned it, but it compiles
nicely for me. Which version of DMD are you using, and are you
having the issues with the
On Thursday, 6 September 2018 at 08:40:08 UTC, Saurabh Das wrote:
Is this a bug with writeln?
Yup. What happens is writeln destructively iterates over b[i].
Since b[i] is a forward range, this shouldn't be done
destructively. Instead, a copy should be made using b[i].save,
somewhere deep in
On Thursday, 6 September 2018 at 09:06:21 UTC, Simen Kjærås wrote:
On Thursday, 6 September 2018 at 08:40:08 UTC, Saurabh Das
wrote:
Is this a bug with writeln?
Yup. What happens is writeln destructively iterates over b[i].
Since b[i] is a forward range, this shouldn't be done
On Wednesday, 5 September 2018 at 22:35:16 UTC, SrMordred wrote:
https://run.dlang.io/is/TOTsL4
Yup, that's a bug. Reduced example:
struct S {
int*[1] arr;
}
import std.traits : hasAliasing;
static assert(hasAliasing!S);
Issue filed: https://issues.dlang.org/show_bug.cgi?id=19228
Pull
On Sunday, 8 July 2018 at 00:52:41 UTC, Flaze07 wrote:
On Sunday, 8 July 2018 at 00:46:13 UTC, Flaze07 wrote:
I want to force the variadic templates's type to be of certain
types, I thought doing this would work
auto sum( A... )( A a ) if( isIntegral!( typeid( a[ 0 ] ) ) )
{
int temp;
On Monday, 9 July 2018 at 05:54:27 UTC, vino.B wrote:
In phase 2 we are transferring few more function to the
existing D code, and these functions has variable number of
parameter and different type eg: Function3(string, string,
string), Function(string, int, string, int).
Initially I
On Friday, 12 January 2018 at 12:57:37 UTC, kdevel wrote:
On Friday, 12 January 2018 at 12:45:59 UTC, kdevel wrote:
suffix.d
```
void main ()
{
real r = 1.L;
float f = 1.f;
}
```
$ dmd suffix.d
suffix.d(3): Error: no property 'L' for type 'int'
suffix.d(4): Error: no property 'f' for
On Friday, 9 March 2018 at 19:24:03 UTC, Nordlöw wrote:
I'm looking for a function (that probably should be placed in
std.meta) named something like `areEqual` that checks whether
all it's arguments are equal or not.
Is there such as function already in Phobos?
My usage is
static if
On Friday, 9 March 2018 at 17:47:46 UTC, Timoses wrote:
To retrieve the member names the following (and filtering for
only the functions) does the job:
alias members = aliasSeqOf!([__traits(allMembers, S)]);
This can be simplified to
alias members = Alias!(__traits(allMembers, S));
On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote:
* aliasOf!int!"string" // multiple ! arguments are not allowed
* (aliasOf!int)!"string" // error c-style cast
* aliasOf!int.aliasOf!"string" // template isAliasOf(alias a)
does not have property 'isAliasOf
Yeah, that's a little hole in
On Saturday, 10 March 2018 at 17:43:06 UTC, Simen Kjærås wrote:
I'm not sure how fixable this is, but I am sure that there's
plenty of benefit to being able to write code like this:
struct S {
int n, m;
SomeType!(() => n + m) a;
}
over this:
struct S {
int n, m;
auto a() {
On Monday, 12 March 2018 at 08:59:49 UTC, Alex wrote:
An incomplete type is perfectly ok, so there should be no
problem with a pointer of the same type inside a struct.
If accidentally the pointer refers "this", then it must have
been set after construction. As before construction the value
of
On Monday, 12 March 2018 at 10:37:00 UTC, Alex wrote:
Sure, you have.
https://dlang.org/spec/struct.html#assign-overload
Point #4.
In this case,
ref S opAssign(ref S rhs)
{
return this;
}
True. Can you fix these, too?
struct S {
S* ptr;
this(int dummy) {
ptr =
}
On Thursday, 1 March 2018 at 08:31:05 UTC, Piotr Mitana wrote:
For some reason this is true:
slide!(Yes.withPartial)([1, 2, 3, 4, 5], 3).array == [[1, 2,
3], [2, 3, 4], [3, 4, 5]]
Shouldn't it rather return [[1], [1, 2], [1, 2, 3], [2, 3, 4],
[3, 4, 5], [4, 5], [5]], or at least [[1, 2, 3],
1 - 100 of 311 matches
Mail list logo