On Saturday, 1 March 2025 at 00:47:20 UTC, Paul Backus wrote:
What you can do is use curly-brace initialization syntax:
```d
struct Test
{
int n;
float f;
static Test opCall(int n, float f)
{
Test result = { n, f };
return result;
}
}
void main()
{
auto
```d
struct Test
{
int n;
float f;
static Test opCall(int n, float f)
{
return Test(n, f);
}
}
void main()
{
Test(1, 2.0);
}
```
This code causes an infinite loop because the `Test(n, f)` inside
the static `opCall` is interpreted as a recursive call to that
sam
Dammit, for some reason any thread I create or reply I post gets
the above title by default, and I don't always realize it before
I click the button. Can a mod delete this and I'll recreate the
thread?
```d
struct Test
{
int n;
float f;
static Test opCall(int n, float f)
{
return Test(n, f);
}
}
void main()
{
Test(1, 2.0);
}
```
This code causes an infinite loop because the `Test(n, f)` inside
the static `opCall` is interpreted as a recursive call to that
sam
On Friday, 10 May 2024 at 00:18:16 UTC, Andy Valencia wrote:
tst7.d(6): Error: cannot implicitly convert expression `e in
this.members` of type `bool*` to `bool`
tst7.d(15): Error: template instance `tst7.Foo!uint` error
instantiating
I'm getting this for this bit of source (trimmed from the
On Monday, 1 August 2022 at 23:35:13 UTC, pascal111 wrote:
This is the definition of "filter" function, and I think it
called itself within its definition. I'm guessing how it works?
'''D
template filter(alias predicate)
if (is(typeof(unaryFun!predicate)))
{
/**
Params:
range =
On Monday, 8 August 2022 at 12:02:02 UTC, Dom Disc wrote:
Hello.
I found in the documentation functions declared like this:
```D
pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
```
This is a template function, even if T is constrained to always
be BigInt (it may also include anything that
On Tuesday, 1 March 2022 at 15:37:55 UTC, Ali Çehreli wrote:
On 3/1/22 07:19, Mike Parker wrote:
> On Tuesday, 1 March 2022 at 13:15:09 UTC, meta wrote:
>
>>
>> enum Color
>> { GRAY }
>>
>> void setColor(Color color);
>>
>> setColor(GRAY);
>
> Then that defeats the purpose of havi
On Tuesday, 1 March 2022 at 12:29:56 UTC, Steven Schveighoffer
wrote:
On 3/1/22 7:22 AM, meta wrote:
If the type is ``Color`` I think the compiler should allow
``GRAY`` if it is a member of ``Color``, isn't how strong
statically typed language should work? I wonder what is the
rational against
If the type is ``Color`` I think the compiler should allow
``GRAY`` if it is a member of ``Color``, isn't how strong
statically typed language should work? I wonder what is the
rational against it? How hard would it be to allow it?
Is the source of 'run.dlang.io' available somewhere?
A trick i use often:
```D
import std;
void main()
{
import uni = std.uni;
writeln("Learning D is fun".split!(uni.isWhite));
}
```
Under-rated way of importing things, you don't bloat your scope
anymore
On Friday, 17 September 2021 at 10:31:34 UTC, bauss wrote:
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote:
Hello D community.
I was browsing the `__traits` keywords and I found `isFuture`
whose descriptions says something about `@future`-annotated
variables.
[link](https://dlan
On Friday, 30 April 2021 at 13:42:49 UTC, Steven Schveighoffer
wrote:
On 4/30/21 9:24 AM, Meta wrote:
My point is that I think marking the *function* nothrow is not
correct, it's the second parameter that dictates the throwing
of the result.
And you can probably fix the second parameter to b
On Thursday, 29 April 2021 at 20:00:23 UTC, novice2 wrote:
i dont understand why (templates too dificult for me yet),
but if i comment "lazy" from T2,
then compiler allow add "nothrow" to "ifThrown"
```d
CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1,
T2)(lazy scope T1 expression, /
On Friday, 30 April 2021 at 13:05:00 UTC, Steven Schveighoffer
wrote:
On 4/29/21 1:50 PM, Meta wrote:
The reason for this, apparently, is in the definition of
`ifThrown`:
```
CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1,
T2)(lazy scope T1 expression, lazy scope T2 errorHandler
On Thursday, 29 April 2021 at 16:02:20 UTC, novice2 wrote:
Hello.
I need use std.format.format() in nothrow function.
format() can throw.
For this case i have special default string.
I don't want embrace format into try..catch block,
and i found elegant std.exception.ifThrown.
But DMD say "ifThro
On Thursday, 8 April 2021 at 18:01:56 UTC, Meta wrote:
On Thursday, 8 April 2021 at 12:19:29 UTC, WebFreak001 wrote:
```d
string to01String(int[] x) @safe
{
auto conv = x.to!(ubyte[]); // allocates new array, so
later cast to string is OK
conv[] += '0'; // assume all numbers are 0-9, t
On Thursday, 8 April 2021 at 12:19:29 UTC, WebFreak001 wrote:
```d
string to01String(int[] x) @safe
{
auto conv = x.to!(ubyte[]); // allocates new array, so
later cast to string is OK
conv[] += '0'; // assume all numbers are 0-9, then this
gives the correct result
return (() @trus
On Wednesday, 7 April 2021 at 17:31:09 UTC, Paul Backus wrote:
On Wednesday, 7 April 2021 at 17:04:56 UTC, novice2 wrote:
On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote:
So, you should change your code to
writefln("%-(%s, %)", s);
sorry i dont read docs so carefully
thanks
On Saturday, 27 March 2021 at 20:44:12 UTC, Brad wrote:
I was looking through lots of sample code on Rosetta Code. D
has a lot of solutions out there. That is really nice but it
has me wondering - coming from other languages that do not
support the concept of immutability - do real world prog
On Wednesday, 10 March 2021 at 04:57:19 UTC, Paul Backus wrote:
On Wednesday, 10 March 2021 at 03:39:15 UTC, Meta wrote:
class Human {
static immutable MAX_AGE = 122;
bool alive = true;
int age = 0;
//Error: mutable method onlineapp.Human.checkAge is not
callable using a const
class Human {
static immutable MAX_AGE = 122;
bool alive = true;
int age = 0;
//Error: mutable method onlineapp.Human.checkAge is not
callable using a const object
invariant(checkAge());
void growOlder()
in(alive)
out(; checkAge())
{
age++;
i
On Tuesday, 23 June 2020 at 23:53:36 UTC, claptrap wrote:
So you have opBinary and half a dozen operators to implement.
Do you use a separate method for each operator or do you have
one method and a big static if else if to select code path?
I assume they are functionally equivalent? So its ju
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote:
Should a range-compliant aggregate type realizing a parser be
encoded as a struct or class? In dmd `Lexer` and `Parser` are
both classes.
In general how should I reason about whether an aggregate type
should be encoded as a struct
On Tuesday, 5 May 2020 at 18:19:00 UTC, Meta wrote:
mixin template magic()
{
alias CallerRet = typeof(return);
CallerRet magic()
{
return CallerRet.init;
}
}
Small edit: you can remove the "CallerRet" alias by doing the
following:
mixin template magic()
{
typeof(r
On Tuesday, 5 May 2020 at 17:11:53 UTC, learner wrote:
On Tuesday, 5 May 2020 at 16:41:06 UTC, Adam D. Ruppe wrote:
typeof(return)
Thank you, that was indeed easy!
Is it possible to retrieve also the caller return type?
Something like:
```
int foo() {
return magic();
}
auto magic(may
Unlike C/C++, char is not a numeric type in D; It's a UTF-8 code
point:
import std.traits;
void main()
{
pragma(msg, isNumeric!char); //Prints false
}
On Monday, 6 April 2020 at 21:23:22 UTC, Quantium wrote:
Are there any libraries to creade a simple discord bot using D?
And if you know these libraries, could you day me their pros
and cons?
I've used https://github.com/b1naryth1ef/dscord to build a
Discord bot, a little over a year ago. How
On Wednesday, 25 December 2019 at 01:24:52 UTC, Adnan wrote:
Does the compiler automatically pass values by reference if
possible with `in` parameters in higher level of optimization
flags? I would normally use `in ref` but sometimes it's not
compatible with different types.
No. "in" is short
On Wednesday, 11 December 2019 at 20:08:37 UTC, Meta wrote:
import std.algorithm;
import std.range;
void mapAccepter(E)(InputRange!E r)
{
import std.array: array;
import std.stdio: writeln;
auto collected = r.array;
writeln(collected);
}
void main()
{
int[] nums = [1, 2, 3]
On Sunday, 8 December 2019 at 01:10:21 UTC, AA wrote:
I'd like to accept the return type of map. From some previous
questions that I should accept a template?
So for something like:
```
void mapAccepter(Range)(Range r)
{
import std.array : array;
import std.stdio : writeln;
auto co
On Tuesday, 3 December 2019 at 22:11:39 UTC, Meta wrote:
On Tuesday, 3 December 2019 at 17:45:27 UTC, H. S. Teoh wrote:
The thing is, `void` means "no return type" (or "no type" in
some contexts), i.e., void == TBottom in that case.
Not *quite* correct. void is not a bottom type; it's a unit
On Tuesday, 3 December 2019 at 17:45:27 UTC, H. S. Teoh wrote:
The thing is, `void` means "no return type" (or "no type" in
some contexts), i.e., void == TBottom in that case.
Not *quite* correct. void is not a bottom type; it's a unit type,
meaning that it's a type with only 1 value (as is nu
On Sunday, 3 November 2019 at 16:55:36 UTC, Vinod K Chandran
wrote:
Hi all,
I can do this in C++. #include
using namespace std ;
#define end };
#define log(x) cout << x << endl
#define wait std::cin.get()
int main() {
log("Trying to avoid the visual clutter aused by closing
curly braces
On Tuesday, 11 June 2019 at 17:12:17 UTC, Robert M. Münch wrote:
Is there a simple and elegant way to do this? Or is just using
a foreach(...) with canFind() the best way?
There are two versions of find that can find a range within
another:
https://dlang.org/phobos/std_algorithm_searching.ht
On Wednesday, 17 April 2019 at 22:37:38 UTC, Adam D. Ruppe wrote:
On Wednesday, 17 April 2019 at 19:07:46 UTC, Jacob Carlborg
wrote:
Perhaps try some of these flags [1] and [2].
oooh, those are very interesting too.
What I was kinda hoping is it would have stats for which file
and line of co
On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote:
Does anyone know if when I create a variable inside a scope as
in
{int a = 10;}
it disappears complete from the memory when the scope finishes?
Or does it remain in some part of the memory? I am thinking of
using scopes to make optimize
On Sunday, 10 February 2019 at 20:04:29 UTC, Per Nordlöw wrote:
Is there a way to query if the -dip1000 flag has been passed to
the compiler? I need it for enabling certain DIP-1000 escape
analysis tests only when -dip1000 has been passed.
For instance
static assert(!__traits(compiles, {
On Wednesday, 30 January 2019 at 01:02:37 UTC, Jonathan M Davis
wrote:
Yeah. It would be like trying to do something like
alias x = this.x;
As it stands, I believe that super is always either used as a
function call to the constructor or to mean the this pointer
for the base class. I don't th
On Monday, 28 January 2019 at 22:17:56 UTC, Steven Schveighoffer
wrote:
On 1/28/19 3:28 PM, Jonathan Levi wrote:
On Sunday, 27 January 2019 at 09:31:46 UTC, bauss wrote:
On Sunday, 27 January 2019 at 05:37:57 UTC, Jonathan Levi
wrote:
This works in LDC *but not* DMD?
. . .
Is this a bug in DMD
On Thursday, 28 June 2018 at 17:00:37 UTC, Mr.Bingo wrote:
I mean, if you think about it, the memory layout of a tuple is
sequential types:
T1
T2
...
So, to popFront a tuple is just changing the starting offset.
You're right; it can definitely be done.
struct TupleRange(T...)
{
size
On Thursday, 14 June 2018 at 11:31:50 UTC, Robert M. Münch wrote:
I have a simple tree C data-structure that looks like this:
node {
node parent:
vector[node] children;
}
I would like to create two foreach algorthims, one follwing the
breadth first search pattern and one the de
On Monday, 11 June 2018 at 04:11:38 UTC, Bauss wrote:
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote:
On Sunday, June 10, 2018 23:59:17 Bauss via
Digitalmars-d-learn wrote:
What is the point of nothrow if it can only detect when
Exception is thrown and not when Error is thrown?
On Saturday, 2 June 2018 at 23:17:48 UTC, Simen Kjærås wrote:
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, w
On Tuesday, 22 May 2018 at 18:20:43 UTC, Robert M. Münch wrote:
I see that I'm writing
try {
... different code ...
} catch (myException e) {
... same handling code ...
}
over and over again.
Of course I can put the exception handling code into a function
to not duplicate it. However,
On Thursday, 17 May 2018 at 15:25:37 UTC, Sjoerd Nijboer wrote:
Given the following code
`struct Foo(T)
if(isNumeric!T)
{
T t;
.. other code
}
struct Bar(T)
if(isNumeric!T)
{
T t;
.. other code
}
Foo!float foo_float;
Foo!double foo_double;
Bar!f
On Thursday, 10 May 2018 at 12:55:36 UTC, Uknown wrote:
On Thursday, 10 May 2018 at 11:06:06 UTC, Per Nordlöw wrote:
On Wednesday, 9 May 2018 at 21:09:12 UTC, Meta wrote:
It's a context pointer to the enclosing
function/object/struct. Mark the struct as static to get rid
of it.
Ok, but why a
On Wednesday, 9 May 2018 at 18:04:40 UTC, Per Nordlöw wrote:
On Wednesday, 9 May 2018 at 17:52:48 UTC, Meta wrote:
I wasn't able to reproduce it on dmd-nightly:
https://run.dlang.io/is/9wT8tH
What version of the compiler are you using?
Ahh, the struct needs to be in a unittest block for it t
On Wednesday, 9 May 2018 at 14:07:37 UTC, Per Nordlöw wrote:
Why (on earth) does
struct S
{
@disable this(this);
int* _ptr;
}
pragma(msg, typeof(S.tupleof));
prints
(int*, void*)
when
struct S
{
int* _ptr;
}
pragma(msg, typeof(S.tupleof
On Thursday, 3 May 2018 at 02:48:10 UTC, jmh530 wrote:
On Thursday, 3 May 2018 at 00:52:58 UTC, Meta wrote:
[snip]
It's not a big per se. It's a consequence of the declaration
expanding to the real template function form (I can't type it
all out as I'm on my phone), thus the inner `val` from
On Wednesday, 2 May 2018 at 20:32:43 UTC, jmh530 wrote:
In the function below, there is a template parameter and a
normal parameter both with the same name. However, the function
returns the normal parameter. The template parameter is
effectively ignored. I was surprised by this behavior.
Is
On Wednesday, 2 May 2018 at 10:39:29 UTC, ag0aep6g wrote:
On 04/28/2018 06:36 PM, Gerald wrote:
What is the appropriate way to create a variable for the range
returned by RedBlackTree lowerBound and upperBound. For
example, given this code:
```
RedBlackTree!long promptPosition = redBlackTree!
On Tuesday, 24 April 2018 at 21:36:19 UTC, Rubn wrote:
I was wondering if I could create my own property in a way that
can be used the same way as something like "T.sizeof". Right
now I have the following to replace length:
uint length32(T)(T[] array)
{
return cast(uint)array.length;
}
I
On Wednesday, 25 April 2018 at 02:32:32 UTC, Per Nordlöw wrote:
On Wednesday, 25 April 2018 at 02:23:04 UTC, Mike Franklin
wrote:
Are people using self assignment of structs as a way of
force-running the postblit? Is there a valid use case for
that?
Mike
If they are, there should be a bett
On Tuesday, 3 April 2018 at 20:02:46 UTC, Vladimirs Nordholm
wrote:
On Tuesday, 3 April 2018 at 19:53:11 UTC, Meta wrote:
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm
wrote:
[...]
In this specific case, since you know the length of `Args`,
you can pre-allocate an array of tha
On Tuesday, 3 April 2018 at 19:02:25 UTC, Vladimirs Nordholm
wrote:
Hello people.
I currently have a function which multiple times per second
takes in arguments, and appends the argument as my special
type. The following code should explain what I do more properly:
struct MySpecialType {
On Wednesday, 21 March 2018 at 15:36:01 UTC, Márcio Martins wrote:
Hi!
How do I get past this?
static struct X {
int x;
private enum T = 1;
private alias M = string;
}
foreach (Member; __traits(allMembers, X)) {
pragma(msg, __traits(getProtection, __traits(getMember,
On Wednesday, 21 February 2018 at 22:11:04 UTC, Jean-Louis Leroy
wrote:
Here's what I am trying to do:
mixin template MakeFun(string ID, int X)
{
int mixin(ID)() { return X; }
}
mixin MakeFun!("one", 1); // int one() { return 1; }
Alas I get:
makefunc.d(3): Error: no identifier for declarato
On Thursday, 15 February 2018 at 00:27:40 UTC, Meta wrote:
On Wednesday, 14 February 2018 at 23:46:30 UTC, aliak wrote:
On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:
Ooh yes, of course! Thank you :)
Even better:
import std.conv;
auto b = a.map!(to!float);
Actually, that won'
On Wednesday, 14 February 2018 at 23:46:30 UTC, aliak wrote:
On Wednesday, 14 February 2018 at 15:14:24 UTC, Meta wrote:
I think the best way to do this is to implement `map` for your
optional type.
Optional!U map(U, alias f)()
{
return empty? no!U : some!U(f(t));
}
Optional!int a = 3;
On Monday, 12 February 2018 at 02:05:16 UTC, aliak wrote:
From spec: Cast expression: "cast ( Type ) UnaryExpression"
converts UnaryExpresssion to Type.
And https://dlang.org/spec/operatoroverloading.html#cast makes
no mention of the return type of opCast. One could think that
the return type
On Friday, 9 February 2018 at 21:31:29 UTC, ShadoLight wrote:
writeln(parse(code)); // to aid with debugging
writeln(convertToD(parse(code))); // debugging aid
..to..
writeln(parse(code)[]); // to aid with debugging
writeln(convertToD(parse(
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 advantage of that over hasAssignableElements? Or
is that just basically combining constraints 3 and 4 which I
have abo
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 Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin wrote:
In C#, structs can inherit from and implement interfaces.
using System;
interface IPrint
{
void Print();
}
struct MyStruct : IPrint
{
public void Print()
{
Console.WriteLine(ToString());
}
}
public
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote:
Hello,
I have been looking at the following example found right at the
end of the section here:
https://dlang.org/spec/declaration.html#alias
struct S { static int i; }
S s;
alias a = s.i; // illegal, s.i is an expression
alias b =
On Monday, 4 December 2017 at 22:34:41 UTC, helxi wrote:
Why can't enums be used as types in this (simplified) example?
enum Positivity
{
Positive,
Negative
}
struct Wave
{
public:
Positivity slope;
}
enum Waves
{
Sin = Wave(Positivity.Positive),
Cos = W
On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy
wrote:
Hello,
I have the following csv text;
auto input = "Start Date,End Date,Subject,All day
event,Categories,Show time as
1/1/2018,1/1/2018,New Year's Day,TRUE,Holiday,3
1/15/2018,1/15/2018,\"Martin Luther King, Jr.
Day\",TRUE
On Friday, 13 October 2017 at 13:22:42 UTC, Adam D. Ruppe wrote:
* Use a @property ref function to return the array element and
trust the compiler to inline it.
You could also use pragma(inline, true).
On Friday, 13 October 2017 at 01:12:38 UTC, solidstate1991 wrote:
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991
wrote:
I'm making a struct for easy color handling Here's a code
sample:
ublic struct Color{
union{
uint raw; ///Raw representation in integer form, also force
On Thursday, 21 September 2017 at 12:30:15 UTC, David Bennett
wrote:
On Thursday, 21 September 2017 at 11:42:36 UTC, David Bennett
wrote:
[snip]
```
string[] escapeCTFE(Args...)(){
static foreach (arg; Args){
static if(__traits(compiles, ###WHATDOIPUTHERE###)){
[snip]
So far the
On Thursday, 24 August 2017 at 19:41:46 UTC, Nordlöw wrote:
Given
enum e = ['a', 'b', 'c'];
import std.meta : AliasSeq;
enum a = AliasSeq!['a', 'b', 'c'];
is it somehow possible to convert (at compile-time) `e` to `a`?
Is it cheaper CT-performance wise to use AliasSeq instead of
enu
It's hard to tell offhand but I would recommend that you extract
the inner string into a function that generates that string,
allowing you to print out the finished product before mixing it
in.
On Thursday, 10 August 2017 at 15:55:41 UTC, Jason Brady wrote:
Wow. That makes perfect sense. I forgot stringof works only
with expressions
It works with symbols too. See the following:
template test(){}
pragma(msg, test.stringof);
On Wednesday, 9 August 2017 at 01:39:07 UTC, Jason Brady wrote:
Why does the following code error out with:
app.d(12,10): Error: function app.FunctionWithArguments (uint
i) is not callable using argument types ()
Code:
import std.stdio;
void FunctionWithoutArguments() {
}
void FunctionWith
On Wednesday, 9 August 2017 at 21:54:46 UTC, Q. Schroll wrote:
For a class/interface type `A` and a class `C` inheriting from
`A` one can do
A a = getA();
if (auto c = cast(C) a)
{ .. use c .. }
to get a `C` view on `a` if it happens to be a `C`-instance.
Sometimes one cannot find a goo
On Thursday, 3 August 2017 at 19:03:55 UTC, Meta wrote:
`mixin vectorize!sin vsin; alias sin = vsin;` and see if it
Should be `alias sin = vsin.sin;`
On Thursday, 3 August 2017 at 15:29:47 UTC, jmh530 wrote:
I am trying to create a vectorize function that mixes in a new
version of function with the same name that applies the
function (to an ndslice).
The code below compiles without error and has the behavior I
would expect.
However, when
On Sunday, 30 July 2017 at 02:58:09 UTC, Mike wrote:
I'm trying to use std.xml, and I can't get it to work.
I tried the simplest program I could think of:
import std.xml;
import std.stdio;
void main()
{
auto parser = new DocumentParser("encoding=\"utf-8\"?>");
parser.onStartTag["device"]
On Thursday, 27 July 2017 at 21:16:03 UTC, Chris wrote:
I'm using regex `matchAll`, and mapping it to get a sequence of
strings. I then want to pass that sequence to a function. What
is the general "sequence of strings" type declaration I'd need
to use?
In C#, it'd be `IEnumerable`. I'd rathe
On Thursday, 20 July 2017 at 13:11:56 UTC, Alex wrote:
On Thursday, 20 July 2017 at 12:33:43 UTC, Alex wrote:
The Problem is, i dont know what type WHAT_TYPE is / i don´t
know how to build a loopable something of futures.
Ok, i think i understood now.
my function `load` returns `KpiResponseEn
On Tuesday, 18 July 2017 at 15:28:06 UTC, Antonio Corbi wrote:
Hi all,
I'm trying dmd-2.075.0-rc1 in one of my projects where I use
`squeeze` and `removechars`. Both of them are flagged as
obsolete and in the docs we are suggested to use functions from
std.regex and/or std.algorithm.
Does a
On Sunday, 9 July 2017 at 21:12:24 UTC, bauss wrote:
On Sunday, 9 July 2017 at 19:43:14 UTC, Christian Köstlin wrote:
I wonder if there is any fiber based / fiber compatible
UI-Toolkit out for dlang. The second question is, if it would
make sense at all to have such a thing?
christian
It do
On Wednesday, 28 June 2017 at 15:55:41 UTC, John Burton wrote:
On Tuesday, 27 June 2017 at 09:54:19 UTC, John Burton wrote:
I'm coming from a C++ background so I'm not too used to
garbage collection and it's implications. I have a function
that creates a std.socket.Socket using new and connects
On Saturday, 24 June 2017 at 08:08:33 UTC, ketmar wrote:
Meta wrote:
So I have no clue what I'm doing wrong. This is driving me
insane.
h. known $#^#$@^@%.
enum SymName = (&symbol).stringof[2..$]; // this, instead of
symbol.stringof
dirty hack, let's hope that DMD devs won't change `
The code:
alias Response = Nullable!(string, "empty response (error)");
Response processMessage(string commandModule)(string message,
bool isCommand)
{
import std.meta;
import std.string;
import std.traits;
import command_uda;
mixin("import " ~ commandModule ~ ';');
b
On Wednesday, 14 June 2017 at 21:15:32 UTC, Nordlöw wrote:
Why isn't
bool c = a[] == 4;
allowed when
a[] = b[] + 4;
is?
given that
int[] a, b;
That's just how it is. There are a lot of array-wise operations
that *could* be implemented in the language but aren't.
On Friday, 21 April 2017 at 18:54:38 UTC, David Sanders wrote:
Thank-you for your input. With your help, I was able to figure
out number whether a type is an instantiation of
std.variant.Algebraic.
Now, I need help on concatenating Template Sequence Parameters.
See the block comments below.
On Friday, 21 April 2017 at 16:31:37 UTC, H. S. Teoh wrote:
On Fri, Apr 21, 2017 at 04:16:30PM +, David Sanders via
Digitalmars-d-learn wrote:
I'm trying to do algebra with types ala
http://chris-taylor.github.io/blog/2013/02/10/the-algebra-of-algebraic-data-types/
Below you will find my a
On Wednesday, 19 April 2017 at 00:22:14 UTC, Mike B Johnson wrote:
On Tuesday, 18 April 2017 at 23:49:35 UTC, ketmar wrote:
Mike B Johnson wrote:
How can I get the return type of the current method without
specifying the name or any complexity? Similar to
typeof(this).
typeof(return)
Than
On Saturday, 8 April 2017 at 22:37:18 UTC, ag0aep6g wrote:
On 04/08/2017 11:59 PM, Meta wrote:
enum a = 0;
template test1()
{
enum b1 = a; //Okay, a is in scope at the declaration site
//enum c = d1; Error: undefined identifier d1
This line works just fine, actually. There's really no
On Saturday, 8 April 2017 at 09:47:07 UTC, biocyberman wrote:
On Friday, 7 April 2017 at 23:53:12 UTC, Ali Çehreli wrote:
The difference is that you can't use funcgen as a regular
template:
funcgen!(void, void);
Error: template instance funcgen!(void, void) mixin templates
are not regu
On Saturday, 8 April 2017 at 12:14:31 UTC, Russel Winder wrote:
On Fri, 2017-04-07 at 22:47 +, Meta via Digitalmars-d-learn
wrote:
[…]
Do you have the -dip1000 switch enabled?
Not as far as I know. Why would I want to do that?
You wouldn't as the std lib doesn't work with it yet.
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote:
Simple Dub build of a Factorial example using Unit-Threaded for
testing. Works fine with ldc2 breaks with dmd. This is on
Debian Sid fully up to date.
|> ldc2 --version
LDC - the LLVM D compiler (1.1.1):
based on DMD v2.071.2 and
On Sunday, 2 April 2017 at 19:42:52 UTC, Inquie wrote:
I would like to write the output of a manifest constant at
compile time to a file instead of console using pragma(msg). Is
this possible?
D does not allow IO at compile time for security reasons.
On Sunday, 12 March 2017 at 21:12:13 UTC, data pulverizer wrote:
On Sunday, 12 March 2017 at 20:15:43 UTC, Meta wrote:
auto max(T: const U, U)(T* x, T* y) <- Changed `ConstOf!U`
to `const U`
{
writeln("Const template");
return *x > *y ? x : y;
}
How detailed can I be about t
On Sunday, 12 March 2017 at 20:22:33 UTC, ketmar wrote:
Meta wrote:
The reason this doesn't work is when you use ConstOf!U, it's
not looking for a `const U`, it's looking for the type
`ConstOf!U`. I'm not sure if this is a bug or not...
no, not a bug. this is the way type deconstruction work
On Sunday, 12 March 2017 at 18:49:22 UTC, data pulverizer wrote:
Hello all,
I am attempting to write templates for differently qualified
types using specialisations. Below is an example for const and
non-const outlining my approach:
``
import std.stdio : writeln;
imp
On Friday, 10 March 2017 at 17:08:42 UTC, Whatsthisnow wrote:
I guess i am just too used to the java way of x.equals(object)
which at the source is exactly 'return this == object'
Java would return false here too, though, if it actually did
`this == object` in its default compare method. If I
1 - 100 of 450 matches
Mail list logo