On Monday, 8 August 2022 at 11:35:48 UTC, pascal111 wrote:
The output of next code is the same to extent that we feel that
there's no difference between "only" and "[]", so what "only"
added here?:
'''D
[1,2,3].writeln;
only(1,2,3).writeln;
'''
output:
[1, 2, 3]
[1, 2, 3]
`only(1,2,3)`
Hello, I have this problem:
```d
static int i;
void bar(T)(){
static if(is(T == int))
(()@system => 1)();
static if(is(T == float))
i = 42;
}
void foo(T)(){
bar!T();
}
void main()@safe pure{
foo!long();
foo!float(); //Error: `pure` function `D
On Monday, 23 May 2022 at 15:14:53 UTC, Vindex wrote:
I have this code:
```
import std.array, std.exception, std.stdio;
mixin template RealizeException() {
this(string msg, string file = __FILE__, size_t line =
__LINE__) {
super(msg, file, line);
}
}
class WrongUsage :
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
On Monday, 16 May 2022 at 09:59:41 UTC, bauss wrote:
On Monday, 16 May 2022 at 09:46:57 UTC, IGotD- wrote:
On Sunday, 15 May 2022 at 13:26:30 UTC, vit wrote:
[...]
This also something I wondered, it should be standard in the D
library. Implementing it can be done straight forward with
Hello, I want read decimal type from sql db, do some arithmetic
operations inside D program and write it back to DB. Result need
to be close to result as if this operations was performed in sql
DB. Something like C# decimal.
Exists this kind of library ind D? (ideally `pure @safe @nogc
On Friday, 13 May 2022 at 11:58:15 UTC, zjh wrote:
On Friday, 13 May 2022 at 08:28:56 UTC, vit wrote:
...
```d
...
this(DataSources dataSources){
this.dataSources = dataSources;
}
...
return new MultiGraph!(staticMap!(PointerTarget, Ts))(ts);//ts
```
How is `ts` convert to
On Friday, 13 May 2022 at 07:32:16 UTC, Chris Katko wrote:
On Friday, 13 May 2022 at 07:05:36 UTC, vit wrote:
On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote:
I have an intrinsicGraph(T) class that is given a pointer to
a T dataSource and automatically polls that variable every
On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote:
I have an intrinsicGraph(T) class that is given a pointer to a
T dataSource and automatically polls that variable every frame
to add it to the graph, whether it's a float, double, integer,
and maybe bool.
[...]
I dont understand
On Wednesday, 11 May 2022 at 20:53:21 UTC, Marvin Hannott wrote:
On Wednesday, 11 May 2022 at 20:23:07 UTC, Ali Çehreli wrote:
On 5/11/22 13:06, Marvin Hannott wrote:
> I appreciate the answer, don't much like the "solutions".
Me neither. :)
> It's not so much about copying
Great!
> scoped
On Friday, 6 May 2022 at 17:17:01 UTC, Dennis wrote:
On Friday, 6 May 2022 at 09:24:06 UTC, vit wrote:
[...]
They were recently updated to match the implementation in 2.100.
[...]
`return scope` means pointer members (such `this.ptr`, `C.ptr`)
may not escape the function, unless they are
Hello, new dmd (2.100) has return/scope changes.
It look like examples at page
https://dlang.org/spec/function.html#ref-return-scope-parameters
are no longer relevant.
What difference are between `return scope`, `scope return` and
`return`?
Why `void* ptr` in struct change effect of `scope
On Friday, 6 May 2022 at 00:41:18 UTC, zjh wrote:
Hello everyone,I have following function:
```d
import core.stdc.stdio;
void f(int i,int j){
printf("%i,%i",i,j);
}
```
I want to forward `int[N]` to `(int i,int j)` etc. How can I
write a forwarding function?
```d
void ff(alias
On Thursday, 5 May 2022 at 11:49:29 UTC, vit wrote:
On Thursday, 5 May 2022 at 10:40:44 UTC, rempas wrote:
I have created a structure that is a actually an array that
allocates memory and growths. It is a template and it has
worked with a couple of types that I have tried with. It
doesn't
On Thursday, 5 May 2022 at 10:40:44 UTC, rempas wrote:
I have created a structure that is a actually an array that
allocates memory and growths. It is a template and it has
worked with a couple of types that I have tried with. It
doesn't work with one tho and I cannot understand why. I will
On Saturday, 30 April 2022 at 20:22:43 UTC, Christian Köstlin
wrote:
I am struggling with initializing an Emsi Containers
DynamicArray in a nice way. Some background information of my
usecase:
I experimenting in porting some old 3d engine code of mine from
c++ to dlang. In the engine I want
On Wednesday, 27 April 2022 at 16:03:32 UTC, user1234 wrote:
On Wednesday, 27 April 2022 at 15:23:26 UTC, vit wrote:
Hi, is it possible to get address of generic function instance
for specified arguments without calling the function?
Example:
```d
auto foo(alias fn, Args...)(auto ref Args
Fix:
```d
auto fn = foo!((a, ref b) => true)(new int(42), x);
```
Hi, is it possible to get address of generic function instance
for specified arguments without calling the function?
Example:
```d
auto foo(alias fn, Args...)(auto ref Args args){
///return function/delegate type of `fn` for arguments `args`
}
void main(){
long x;
auto fn =
On Tuesday, 26 April 2022 at 23:33:28 UTC, cc wrote:
On Tuesday, 26 April 2022 at 22:16:01 UTC, cc wrote:
Test application:
I should point out that all this stuff with saving refcounted
things to arrays and so on is extremely untested and
experimental
One problem I'm seeing is the
On Wednesday, 20 April 2022 at 10:42:59 UTC, rempas wrote:
I'm trying to create an associative array where the keys will
be a "string" type and the values will be function pointers.
I'm using a custom type is called "file_struct" and for anyone
that wants to try specifically with this type,
Hello,
Why doesn't this code compile?
```d
static struct Foo{
void *ptr;
void proxySwap1(scope ref typeof(this) rhs)scope pure nothrow
@trusted @nogc{
auto tmp = this.ptr;
this.ptr = rhs.ptr;
rhs.ptr = tmp;
}
void proxySwap2()(scope ref typeof(this)
On Saturday, 2 April 2022 at 14:49:15 UTC, Vijay Nayar wrote:
On Saturday, 2 April 2022 at 14:35:10 UTC, Vijay Nayar wrote:
The `tryMatch` method fails to compile, and instead I get the
following error:
```d
/dlang/dmd/linux/bin64/../../src/phobos/std/sumtype.d(2004):
Error: static assert:
On Friday, 1 April 2022 at 22:22:21 UTC, Vijay Nayar wrote:
Consider the following program:
```d
void main()
{
import std.stdio;
import std.container.rbtree;
import std.variant;
[...]
Variant can contain any type => variant cannot assume attributes
like pure nothrow @safe @nogc
On Wednesday, 30 March 2022 at 12:56:39 UTC, Vijay Nayar wrote:
On Wednesday, 30 March 2022 at 12:53:10 UTC, vit wrote:
use two delegates :)
```d
(){
// Deliberately create a copy to keep in delegate scope.
string myStr = i.dup;
// The
On Wednesday, 30 March 2022 at 12:46:07 UTC, Vijay Nayar wrote:
Consider the following code example:
```d
import std.stdio;
void main()
{
alias DelegateT = string delegate();
// An array of delegates, each has their own scope.
DelegateT[] funcs;
foreach (i; ["ham", "cheese"]) {
//
On Sunday, 27 March 2022 at 16:27:44 UTC, JN wrote:
I would like to have only one definition of getX if possible,
because they both are doing the same thing. I can't remove the
ref one, because without a ref it will pass the struct as a
temporary and compiler won't like that.
```d
import
Hello,
why this code compile without problems:
```d
struct Query{
public const SharedPtr!Builder builder;
}
interface Builder{
void build(ref Query query);
}
struct SharedPtr(T){
enum touch_T = __traits(hasMember, T, "touch");
//...
}
void main(){
}
```
but if `ref Query
On Tuesday, 1 March 2022 at 08:40:12 UTC, Vijay Nayar wrote:
I've randomly encountered a strange error, and I cannot find
any explanation for it in the official documentation of syntax.
[...]
Here is more info (3.):
On Tuesday, 1 March 2022 at 08:40:12 UTC, Vijay Nayar wrote:
I've randomly encountered a strange error, and I cannot find
any explanation for it in the official documentation of syntax.
Essentially, a class cannot call function overload in a
super-class if the class itself contains an
On Tuesday, 1 March 2022 at 08:16:13 UTC, Mike Parker wrote:
On Tuesday, 1 March 2022 at 07:16:11 UTC, bauss wrote:
Right now if you want to add an additional cast then you have
to implement ALL the default behaviors and then add your
custom cast.
It's two template functions like the OP
On Tuesday, 25 January 2022 at 09:48:25 UTC, forkit wrote:
so I'm trying to write (or rather learn how to write) a
'variadic template function', that returns just one of its
variadic parameter, randomly chosen.
But can't get my head around the problem here :-(
.. Error: template
On Saturday, 22 January 2022 at 19:01:09 UTC, Stanislav Blinov
wrote:
On Saturday, 22 January 2022 at 18:00:58 UTC, vit wrote:
[...]
Take by value and make a copy without forwarding:
```d
import std.typecons : Tuple;
import std.meta : allSatisfy;
[...]
Thanks, second options is what I
On Saturday, 22 January 2022 at 17:23:12 UTC, Ali Çehreli wrote:
On 1/22/22 07:17, vit wrote:
> Why local variable of type tuple call destructors immediately
after
> initialization?
I don't even understand where the local variable comes from. If
you want a pair of Foo objects, I would use
On Saturday, 22 January 2022 at 14:23:32 UTC, Adam Ruppe wrote:
You can't forward to a local variable. Local variables will be
a copy of the tuple. forward only actually works if sent
*directly* to another function call.
There's a bunch of things in D that only work in function
parameter
Hello,
Why is tuple variable `params` immediately destructed after its
construction?
Why is `check(-2)` after `dtor(2)`?
Code:
```d
import std.stdio : writeln;
import core.lifetime : forward, move;
struct Foo{
int i;
this(int i){
this.i = i;
writeln("ctor(", i,
On Wednesday, 19 January 2022 at 08:47:27 UTC, Enjoys Math wrote:
```
module expr;
import dots;
import operator;
import equation;
import var;
import var_expr;
import zz_const;
class Expr
{
public:
void opBinary(string op)(string s) const
{
static if (op == "+")
{
On Wednesday, 19 January 2022 at 04:15:54 UTC, Steven
Schveighoffer wrote:
On 1/18/22 7:19 AM, vit wrote:
On Tuesday, 18 January 2022 at 12:05:38 UTC, Paul Backus wrote:
On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote:
At the very top of my module I have this declaration:
```d
On Tuesday, 18 January 2022 at 12:05:38 UTC, Paul Backus wrote:
On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote:
At the very top of my module I have this declaration:
```d
static if (__VERSION__ >= 2098)
{
alias Foo = TypeA;
}
else
{
alias Foo = TypeB;
}
```
No problem inside
On Tuesday, 18 January 2022 at 04:42:45 UTC, frame wrote:
At the very top of my module I have this declaration:
```d
static if (__VERSION__ >= 2098)
{
alias Foo = TypeA;
}
else
{
alias Foo = TypeB;
}
```
No problem inside the module itself but this doesn't work when
imported from
On Wednesday, 12 January 2022 at 08:04:19 UTC, vit wrote:
Hello, I have this code:
```d
[...]
run.dlang.io has old version of dmd-beta/dmd-nightly with bug
Hello, I have this code:
```d
import core.lifetime : move, forward;
import std.stdio : writeln;
struct Foo{
int i;
static auto make(int i){
Foo tmp;
tmp.i = i;
return move(tmp);
}
this(scope const ref typeof(this) rhs){
this.i = rhs.i;
On Wednesday, 12 January 2022 at 06:58:47 UTC, vit wrote:
On Wednesday, 12 January 2022 at 06:43:40 UTC, forkit wrote:
On Wednesday, 12 January 2022 at 06:16:49 UTC, vit wrote:
Yes std.algorithm : filter.
```d
import std.stdio : writeln;
import std.algorithm : filter;
void main()@safe{
On Wednesday, 12 January 2022 at 06:43:40 UTC, forkit wrote:
On Wednesday, 12 January 2022 at 06:16:49 UTC, vit wrote:
Yes std.algorithm : filter.
```d
import std.stdio : writeln;
import std.algorithm : filter;
void main()@safe{
auto a = ["one", "one", "two", "one", "two", "one",
On Wednesday, 12 January 2022 at 05:27:08 UTC, forkit wrote:
I am familiar with the concept of a slice in D.
However, a slice is a consecutive slice, is in not? (e.g)
[4..$-1]
I would like a slice (or a view, or whatever name you wanna
call it), of particular elements within an array that
On Wednesday, 5 January 2022 at 09:17:54 UTC, rempas wrote:
On Wednesday, 5 January 2022 at 09:02:53 UTC, vit wrote:
Try this:
```d
pragma(msg, type_check!("static if", "i8", "true", "5", "4",
"10", "5"));
```
Result:
```d
static if(is_same!(num, i8)) {
mixin(base_digit!("5", "4", "10",
On Wednesday, 5 January 2022 at 08:40:15 UTC, rempas wrote:
I'm trying to use mixins and enums to "expand" code in place
but the results are not what I expected and I'm getting an
weird error. I have created the smallest possible example to
reproduce the error and it is the following:
[...]
On Wednesday, 5 January 2022 at 08:40:15 UTC, rempas wrote:
I'm trying to use mixins and enums to "expand" code in place
but the results are not what I expected and I'm getting an
weird error. I have created the smallest possible example to
reproduce the error and it is the following:
[...]
On Wednesday, 29 December 2021 at 01:00:53 UTC, Tejas wrote:
On Tuesday, 28 December 2021 at 18:27:36 UTC, vit wrote:
[...]
Since a destructor ignores `const`, I think adding the `~this`
to Foo manually is somehow making the compiler have to actually
cast away const, which it is doing via
Hi, why this code doesn't compile?
```d
struct Foo{
bool opCast(T : bool)()const{
assert(0);
}
~this(){}
}
struct Bar{
const Foo foo;
}
void main(){
}
```
Error: template instance `opCast!(Foo)` does not match template
declaration `opCast(T : bool)()`
On Tuesday, 21 December 2021 at 08:26:17 UTC, rempas wrote:
On Tuesday, 21 December 2021 at 08:11:39 UTC, Anonymouse wrote:
I'm not certain I understand, but won't `foreach (i, a; args)
{ /* ... */ }` in his example do that?
As in, if you necessarily must index `args` instead of using a
On Sunday, 19 December 2021 at 23:21:00 UTC, Stanislav Blinov
wrote:
On Sunday, 19 December 2021 at 22:29:21 UTC, vit wrote:
Hello,
Why is copy ctor in this example not called?
Because D runtime isn't properly married to copy constructors
yet. I.e. it's a bug, a variant of this one:
Hello,
Why is copy ctor in this example not called?
```d
import std.stdio;
struct Foo {
int i;
this(int i){
this.i = i;
writeln("init: ", i);
}
this(ref typeof(this) rhs){
this.i = rhs.i;
writeln("copy: ", i);
}
~this() {
On Tuesday, 14 December 2021 at 14:40:00 UTC, RazvanN wrote:
On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote:
Hello, why does this code fail to compile?
```d
struct Foo(T){
this(Rhs, this This)(scope Rhs rhs){
}
this(ref scope typeof(this) rhs){
}
}
struct Bar{
On Sunday, 12 December 2021 at 18:32:28 UTC, Imperatorn wrote:
On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote:
Hello, why does this code fail to compile?
```d
struct Foo(T){
this(Rhs, this This)(scope Rhs rhs){
}
this(ref scope typeof(this) rhs){
}
}
struct Bar{
Hello, why does this code fail to compile?
```d
struct Foo(T){
this(Rhs, this This)(scope Rhs rhs){
}
this(ref scope typeof(this) rhs){
}
}
struct Bar{
Foo!int foo;
}
void main(){
}
```
error: Segmentation fault (core dumped)
On Thursday, 19 August 2021 at 08:25:23 UTC, Bienlein wrote:
On Thursday, 19 August 2021 at 07:30:38 UTC, Bienlein wrote:
Hello,
I allocate some instance of class C manually and then free the
memory again:
class C {
int num;
~this() {
writeln("~this");
}
On Monday, 9 August 2021 at 02:47:40 UTC, Mathias LANG wrote:
On Sunday, 8 August 2021 at 18:36:02 UTC, vit wrote:
Hello, is there reason why elements of input range must be
copyable?
By design, not that I can think of. But it is assumed all over
the place, unfortunately. You can make your
Hello, is there reason why elements of input range must be
copyable?
For example this example works and copy ctor is never called:
```d
import std.algorithm : map;
import std.range;
struct Foo{
int i;
this(scope ref typeof(this) rhs)pure nothrow @safe @nogc{
//this.i =
Hello,
Why this doesn't work:
```d
template DestructorType(T){
alias Get(T) = T;
alias DestructorType = Get!(typeof((void*){
T tmp;
}));
}
struct Foo{
~this()@safe{}
}
```
```d
void main(){
//Error: static assert: `is(void function(void*) pure
nothrow
On Monday, 14 June 2021 at 13:31:51 UTC, baby_tiger wrote:
this used work for me, after upgrade I get this error. how to
fix it ?
import std.traits;
enum LogLevel : ubyte {
INFO = 0,
WARN,
ERROR,
On Monday, 2 August 2021 at 11:28:46 UTC, Tejas wrote:
On Monday, 14 June 2021 at 13:31:51 UTC, baby_tiger wrote:
[...]
It seems to not work at runtime either. Maybe they've made this
behaviour illegal now? Hopefully someone answers.
```d
import std.traits;
import core.stdc.stdarg;
On Friday, 23 July 2021 at 20:24:02 UTC, Jim wrote:
Hello,
I've been playing with D and trying to understand how to work
with @nogc. I must be doing something wrong, because even
though I tagged the destructor for my class `@nogc`, I'm
getting the following error: `.\min.d(27): Error:
On Wednesday, 21 July 2021 at 08:28:22 UTC, Mike Parker wrote:
On Wednesday, 21 July 2021 at 08:11:06 UTC, vit wrote:
Is it possible to call all shared static ctors in betterC?
```d
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i
Is it possible to call all shared static ctors in betterC?
```d
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i != 42);
}
```
On Tuesday, 20 July 2021 at 06:20:34 UTC, Tejas wrote:
...
Initially, I was trying to create the spaceship operator of
C++, but we aren't allowed to create new operators
...
D has spaceship operator: opCmp
(https://dlang.org/spec/operatoroverloading.html#compare).
On Wednesday, 14 July 2021 at 15:19:03 UTC, vit wrote:
```d
import std.stdio;
struct abc{
int[100] a;
struct Proxy{
abc* ptr;
const int index;
int opUnary(string op : "++")(){
return ++ptr.a[index]; //add missing ++
}
}
On Wednesday, 14 July 2021 at 15:01:45 UTC, wjoe wrote:
On Wednesday, 14 July 2021 at 14:39:03 UTC, vit wrote:
On Wednesday, 14 July 2021 at 13:16:49 UTC, Tejas wrote:
[...]
This work:
```d
import std.stdio;
struct abc{
int[100] a;
ref int opIndex(int index)return{
On Wednesday, 14 July 2021 at 13:16:49 UTC, Tejas wrote:
On Wednesday, 14 July 2021 at 13:09:56 UTC, vit wrote:
On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
[...]
From doc: https://dlang.org/spec/operatoroverloading.html
Postincrement e++ and Postdecrement e-- Operators
These are
On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
On Wednesday, 14 July 2021 at 12:35:07 UTC, wjoe wrote:
On Wednesday, 14 July 2021 at 11:31:36 UTC, Tejas wrote:
``` {auto a = i[1] , ++i[1] , a} //note the , not the ;```
Sorry I can't provide something even more concrete.
Yes I saw
On Wednesday, 7 July 2021 at 19:14:52 UTC, Kevin Bailey wrote:
I'm trying to use some fairly simple template argument
deduction, but
maybe I'm not getting the syntax correct. C++ doesn't event
blink at
something like this, but D is giving me:
temptest.d(18): Error: template temptest.func
On Wednesday, 23 June 2021 at 15:48:57 UTC, Tejas wrote:
On Wednesday, 23 June 2021 at 15:31:04 UTC, vit wrote:
Hello,
I am implementing @nogc string struct similar to c++
std::basic_string (link
https://code.dlang.org/packages/basic_string).
C++ string has methods front, back and pop_back
Hello,
I am implementing @nogc string struct similar to c++
std::basic_string (link
https://code.dlang.org/packages/basic_string).
C++ string has methods front, back and pop_back
returning/deleting code units.
D strings has functions (std.range) front, back and popBack
returning/deleting
Are asserts enough to make method @trusted or is something like
throw exception or return error code necessary? How it work in
phobos?
Example:
```d
struct Slice(T){
private T[] data;
this(T[] data){
this.data = data;
}
inout(T)[] opSlice()inout scope return
On Sunday, 13 June 2021 at 17:18:46 UTC, ag0aep6g wrote:
On Sunday, 13 June 2021 at 16:27:18 UTC, vit wrote:
Why I can take address of Foo variable but not Bar?
```d
//-dip1000
struct Foo{
private double d;
}
struct Bar{
private void* ptr;
}
void main()@safe{
///this is OK:
Why I can take address of Foo variable but not Bar?
```d
//-dip1000
struct Foo{
private double d;
}
struct Bar{
private void* ptr;
}
void main()@safe{
///this is OK:
{
scope Foo x;
scope ptr =
}
///Error: cannot take address of `scope` local `x` in
On Wednesday, 10 February 2021 at 12:17:43 UTC, rm wrote:
On 09/02/2021 5:05, frame wrote:
On Sunday, 7 February 2021 at 14:13:18 UTC, vitamin wrote:
Why using 'new' is allowed in pure functions but calling
GC.addRange or GC.removeRange isn't allowed?
Does 'new' violate the 'pure' paradigm?
On Tuesday, 19 January 2021 at 06:49:06 UTC, Kyle Ingraham wrote:
I’m sorry that this isn’t a solution to your problem but your
code caught my attention. What is your snippet supposed to do?
This is more specific example:
https://run.dlang.io/is/W7rd2u
import std.traits : CopyTypeQualifiers;
On Friday, 11 December 2020 at 11:25:22 UTC, Andrey Zherikov
wrote:
Here is the example:
alias f1 = (string ) {}; f1(int .init);
alias f2 = (string s) {}; f2(int .init);
alias f3 = (int ) {}; f3(string.init);
alias f4 = (int i ) {}; f4(string.init);
"f1" case compiles
On Monday, 3 September 2018 at 09:09:44 UTC, Andrey wrote:
Hello,
Here is a code with comments: https://run.dlang.io/is/BNl2Up.
I don't understand how to pass lambda into template.
I get an error:
onlineapp.d(18): Error: template instance `qwerty!((i) => "arg"
~ i.to!string ~ "[0] == '?'",
On Thursday, 30 August 2018 at 11:34:36 UTC, Andrey wrote:
On Thursday, 30 August 2018 at 11:09:40 UTC, vit wrote:
[...]
I want to create a reusable template for this purpose.
Why I can't use "staticMap" so that compiler it self would do
this:
[...]
Just wrap some some symbol "args" with
On Thursday, 30 August 2018 at 10:41:58 UTC, Andrey wrote:
Hello,
This code doesn't print enum values:
import std.meta;
import std.traits;
import std.stdio;
enum MyEnum : string
{
First = "F_i_r_s_t",
Second = "S_e_c_o_n_d"
}
alias QW(alias arg) =
On Wednesday, 29 August 2018 at 19:56:31 UTC, Everlast wrote:
On Tuesday, 28 August 2018 at 22:01:45 UTC, Paul Backus wrote:
[...]
One of the things that makes a good language is it's internal
syntactic consistency. This makes learning a language easier
and also makes remembering it easier.
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote:
Hello,
Let we have two variadic templates:
template Qwerty(Values...) {}
template Qaz(alias type, Data...) {}
Now I want to add a constraint to "Qwerty" so that each type in
"Values" pack must be a "Qaz" template. I don't care about
On Monday, 27 August 2018 at 12:54:59 UTC, SG wrote:
On Monday, 27 August 2018 at 03:21:04 UTC, rikki cattermole
wrote:
Templates make it the easiest way, since common patterns, like
arrays, classes and pointers have the exact same null check
syntax.
I see.
That code is only for classes. C#
On Friday, 24 August 2018 at 15:18:13 UTC, Peter Alexander wrote:
Consider this code, which is used as an example only:
auto scaleAll(int[] xs, int m) {
return xs.map!(x => m * x);
}
As m is captured, the delegate for map will rightly allocate
the closure in the GC heap.
In C++, you would
On Monday, 20 August 2018 at 13:22:02 UTC, Andrey wrote:
On Monday, 20 August 2018 at 13:14:14 UTC, Andrey wrote:
Mistake... this is:
static void log(bool newline = true)(string text)
{
alias print(T...) = newline ? :
_file.print(text);
text.print();
}
static void log(bool newline
On Tuesday, 14 August 2018 at 14:37:33 UTC, Andrey wrote:
On Tuesday, 14 August 2018 at 14:07:23 UTC, Timoses wrote:
Here's one version:
template StringEnumValues(alias Enum)
{
import std.traits : EnumMembers;
string[] StringEnumValues()
{
string[] enumValues;
On Wednesday, 8 August 2018 at 17:40:11 UTC, ketmar wrote:
vit wrote:
Hello, is in phobos some function which convert float/double
to string and is pure @nogc and nothrow?
i don't think that you can make it `pure`, but you certainly
can make it `nothrow`, `@nogc` and ctfe-able. it's
Hello, is in phobos some function which convert float/double to
string and is pure @nogc and nothrow?
On Monday, 6 August 2018 at 21:23:36 UTC, Paul Backus wrote:
On Monday, 6 August 2018 at 20:22:36 UTC, vit wrote:
On Monday, 6 August 2018 at 19:56:03 UTC, Steven Schveighoffer
wrote:
BTW, is there a reason you aren't just using Algebraic?
https://dlang.org/phobos/std_variant.html#.Algebraic
On Monday, 6 August 2018 at 20:29:29 UTC, Alexandru Ermicioi
wrote:
Hi Dlang community!
I've been playing with dip1000 and scope storage class and
stumbled upon a strange error that I can't to understand yet.
Here is minimized version of code that generates the error:
[...]
Parameter
On Monday, 6 August 2018 at 19:56:03 UTC, Steven Schveighoffer
wrote:
BTW, is there a reason you aren't just using Algebraic?
https://dlang.org/phobos/std_variant.html#.Algebraic
-Steve
primarily visit for Algebraic isn't pure, @nogc, @safe, nothrow.
On Monday, 6 August 2018 at 19:17:58 UTC, nkm1 wrote:
On Monday, 6 August 2018 at 18:22:24 UTC, vit wrote:
Hello,
I have this struct:
struct S{
uint kind;
void[N] data_;
}
Instances of struct S are allocated by standard GC new and
S.data_ can contain pointers/ranges to GC allocated
On Monday, 6 August 2018 at 18:28:11 UTC, Steven Schveighoffer
wrote:
On 8/6/18 2:22 PM, vit wrote:
Hello,
I have this struct:
struct S{
uint kind;
void[N] data_;
define "N"
}
Instances of struct S are allocated by standard GC new and
S.data_ can contain pointers/ranges to GC
Hello,
I have this struct:
struct S{
uint kind;
void[N] data_;
}
Instances of struct S are allocated by standard GC new and
S.data_ can contain pointers/ranges to GC allocated data.
If is GC disabled then program run fine. But when is GC enabled
then it fail randomly.
If the
On Sunday, 5 August 2018 at 10:57:32 UTC, Steven Schveighoffer
wrote:
On 8/5/18 5:20 AM, vit wrote:
It's possible create something like this without errors?
void main()@nogc{ //Error: function `app.main` is `@nogc`
// yet allocates closures with the GC
import
It's possible create something like this without errors?
void main()@nogc{ //Error: function `app.main` is `@nogc`
// yet allocates closures with the GC
import std.experimental.all;
const int j = 2;
int i = 0;
const int[3] tmp = [1, 2, 3];
tmp[]
On Friday, 13 July 2018 at 11:37:09 UTC, Michael wrote:
On Friday, 13 July 2018 at 11:17:32 UTC, Radu wrote:
On Friday, 13 July 2018 at 11:12:47 UTC, Michael wrote:
On Friday, 13 July 2018 at 10:52:54 UTC, Radu wrote:
On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote:
[...]
Do you try
1 - 100 of 124 matches
Mail list logo