On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Maybe I'm missing the thing, but I'm not able to declare local
ref variable even if simple workaround exists. Is this
preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main
On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote:
Thanks for answer, I'm coming from C++. But anyway, pointers
are not allowed in @safe code, so this is not always solution.
Workaround exits even for @safe code, so my question remains
the same. What is a rationale for such a lang
On Monday, 25 November 2019 at 08:20:59 UTC, rumbu wrote:
On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote:
Thanks for answer, I'm coming from C++. But anyway, pointers
are not allowed in @safe code, so this is not always solution.
Workaround exits even for @safe code, so my ques
On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:
I want to add version to my program.
I have configurated my version file "version.txt", but I dont
know how link this file to my program. If Need spec file,
please send the exemple code of spec. Or is is possible add
version file by d
I am trying to create an array of functions inside a struct.
struct S {
void f1() {}
void f2() {}
alias Func = void function();
immutable Func[2] = [&f1, &f2]
}
What I got: Error: non-constant expression '&f1'
Tried also with delegates (since I am in a struct context but I
got: no `t
On Sunday, 5 January 2020 at 13:33:35 UTC, Marcone wrote:
I am using this code to load icon from local directory, but I
want to load icon from resource.res file:
wndclass.hIcon = LoadImage( NULL, "icon.ico", IMAGE_ICON, 0,
0, LR_LOADFROMFILE| LR_SHARED | LR_LOADTRANSPARENT);
You cannot load
On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote:
#include
#include
#include
#include "resource.h"
#include
HINSTANCE hInst;
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
}
return TRUE;
On Wednesday, 29 January 2020 at 08:40:48 UTC, p.shkadzko wrote:
Has anyone read "d programming language tutorial: A Step By
Step Appoach: Learn d programming language Fast"?
https://www.goodreads.com/book/show/38328553-d-programming-language-tutorial?from_search=true&qid=G9QIeXioOJ&rank=3
Be
Can some C++ guru translate in D the template below?
I gave up after reading a lot, but I didn't manage to understand
the meaning "&& ..."
template static uint8_t
composite_index_size(Tables const&... tables) { return
(composite_index_size(tables.size(),
impl::bits_needed(sizeof...(tables)
On Saturday, 6 February 2021 at 00:35:12 UTC, Ali Çehreli wrote:
On 2/5/21 1:10 PM, Rumbu wrote:
I gave up after reading a lot, but I didn't manage to
understand the meaning "&& ..."
I think it's the universal reference.
Thank you Ali, but nope, it's "parameter pack folding". This
allows s
On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson
wrote:
Reading documentation... Array, Algorithms, ... maybe I've been
up too late... how does one obtain the index of, say, 55 in an
array like this
int[] a = [77,66,55,44];
I want to do something like:
int i = a.find_va
On Monday, 8 February 2021 at 12:19:26 UTC, Basile B. wrote:
On Monday, 8 February 2021 at 11:42:45 UTC, Vindex wrote:
size_t ndim(A)(A arr) {
return std.algorithm.count(typeid(A).to!string, '[');
}
Is there a way to find out the number of dimensions in an
array at compile time?
yeah.
-
On Tuesday, 9 February 2021 at 19:37:17 UTC, WhatMeWorry wrote:
I'm trying to create a super simple dynamic library consisting
of two files:
file2.d --
extern(D):
double addEight(double d) { return (d + 8.0); }
fileB.d -
On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote:
I have a base class A, where I make specific operator depending
on the derived class type. Currently I'm using something like
this:
c is a class derived from A
bool shouldDoX = (cast(X)c) !is null || (cast(Y)c) !is null ||
(cast(K)c)
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote:
I need to check if an instance is of a specific type derived
from my base class but this class has template parameter and
this type isn't available at time I'm checking it. Something
like:
class B { }
class A(T) : B { }
class X : B { }
In the expression below:
return matchAll(content, keywordsPattern)
.map!(a => a.hit.stripLeft("[").strip("]"))
.fold!((a, b) => a ~ "," ~ b)
.splitter(',')
.map!(a => a.stripLeft("\" ").strip("\" "))
.filter!(a => !a.any!(b => b == ' ' |
On Wednesday, 17 February 2021 at 10:15:10 UTC, Mitacha wrote:
it'll use empty string as first element in range.
BTW perheps you could use `joinner` instead of this `fold` to
join values with ",".
Thanks for that. I thought to joiner too, but it doesn't work. I
need fold to take a list of s
On Wednesday, 17 February 2021 at 12:58:29 UTC, Mitacha wrote:
On Wednesday, 17 February 2021 at 11:38:45 UTC, Rumbu wrote:
[...]
If you replace `fold` and `splitter` with this, then it doesn't
allocate:
```
auto fn() @nogc {
return only("k1,k2", "k3,k4")
.map!(x => x.splitter(",
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote:
I'm using a windows callback function where the user-defined
value is passed thought a LPARAM argument type. I'd like to
pass my D array then access it from that callback function. How
is the casting from LPARAM to my type array done in t
On Sunday, 28 February 2021 at 09:04:49 UTC, Rumbu wrote:
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote:
I'm using a windows callback function where the user-defined
value is passed thought a LPARAM argument type. I'd like to
pass my D array then access it from that callback function.
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote:
XMM registers work, but as soon as they are changed into YMM
DMD outputs "bad type/size of operands %s" and LDC outputs an
"label YMM0 is undefined" error. Are they not supported?
To illutrate : https://run.dlang.io/is/IqDHlK
By the way, how ca
On Friday, 5 March 2021 at 21:47:49 UTC, z wrote:
On Friday, 5 March 2021 at 16:10:02 UTC, Rumbu wrote:
First of all, in 64 bit ABI, parameters are not passed on
stack, therefore a[RBP] is a nonsense.
void complement32(simdbytes* a, simdbytes* b)
a is in RCX, b is in RDX on Windows
a is in RD
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote:
On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote:
What... Is this really how it's supposed to be? Makes no sense
to not use any of the existing conventions.
extern(C) and extern(D) are both documented to be the same as
Just playing around with attributes.
This is valid D code:
```d
@
nogc: //yes, this is @nogc in fact, even some lines are between
@
/* i can put some comments
*/
/** even some documentation
*/
// single line comments also
(12)
// yes, comments and newlines are allowed between attribute
On Thursday, 25 November 2021 at 10:10:25 UTC, Dennis wrote:
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
Also, this works also for #line, even if the specification
tells us that all tokens must be on the same line
Where does it say that?
Well:
```
#line IntegerLiteral Filesp
On Thursday, 25 November 2021 at 11:25:49 UTC, Ola Fosheim
Grøstad wrote:
On Thursday, 25 November 2021 at 10:41:05 UTC, Rumbu wrote:
I am not asking this questions out of thin air, I am trying to
write a conforming lexer and this is one of the ambiguities.
I think it is easier to just look at
```d
class S {}
class A:S {}
class B:S {}
mixin template vmix(T)
{
void visit(T t) {}
}
class Visitor
{
void visit(S s) {}
mixin vmix!A;
mixin vmix!B;
}
class AnotherVisitor: Visitor
{
override void visit(A a) {}
}
```
This will result in error when I try to override mixin
On Friday, 3 December 2021 at 10:57:34 UTC, Stanislav Blinov
wrote:
On Friday, 3 December 2021 at 10:42:37 UTC, Rumbu wrote:
Bug or feature? Is there any workaround?
The error message explains what to do :)
Error: class `mixinover.AnotherVisitor` use of
`mixinover.Visitor.visit(S s)` is hid
On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote:
Let's say I want to skip characters and build a new string.
The character I want to skip: `;`
Expected result:
```
abcdefab
```
Since it seems there is a contest here:
```d
"abc;def;ghi".split(';').join();
```
:)
On Friday, 10 December 2021 at 11:06:21 UTC, IGotD- wrote:
On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote:
Since it seems there is a contest here:
```d
"abc;def;ghi".split(';').join();
```
:)
Would that become two for loops or not?
I thought it's a beauty contest.
```d
string
On Friday, 10 December 2021 at 18:47:53 UTC, Stanislav Blinov
wrote:
Be interesting to see if this thread does evolve into a SIMD
http://lemire.me/blog/2017/01/20/how-quickly-can-you-remove-spaces-from-a-string/
On Saturday, 11 December 2021 at 14:42:53 UTC, russhy wrote:
Here is mine
- 0 allocations
- configurable
- let's you use it how you wish
- fast
You know that this is already in phobos?
```
"abc;def;ghi".splitter(';').joiner
```
I am trying to understand why in this two different cases (Simple
and Complex), the compiler behaviour is different.
```d
struct SimpleStruct { int x;}
struct ComplexStruct { int[] x; }
void main()
{
SimpleStruct[] buf1;
immutable(SimpleStruct)[] ibuf1;
buf1[0 .. 10] = ibuf1[0 .. 10
On Tuesday, 14 December 2021 at 12:13:23 UTC, Stanislav Blinov
wrote:
Because is(typeof(immutable(ComplexStruct).x) ==
immutable(int[])). Can't bind an array of immutable to array of
mutable. This would require a deep copy, i.e. copy constructor.
This means that the only way to write a gener
On Tuesday, 14 December 2021 at 16:21:03 UTC, Steven
Schveighoffer wrote:
On 12/14/21 11:19 AM, Steven Schveighoffer wrote:
Er... scratch that, this isn't construction, it should use
opAssign. Again, probably because memcpy+postblit is used by
the runtime.
If not reported, it should be.
Si
On Monday, 20 December 2021 at 08:45:50 UTC, rempas wrote:
Here I am having a problem with templates again. No matter how
much I read, I can't seem to understand how templates/mixins
work.
So any ideas why this doesn't work?
because you cannot have statements directly in a template (the
fac
On Monday, 20 December 2021 at 10:49:20 UTC, rempas wrote:
On Monday, 20 December 2021 at 09:30:30 UTC, rumbu wrote:
Thanks a lot for the info. When I try to use this code, I'm
getting the following error:
```
Error: expression expected, not `%`
Error: expression expected, not `%`
```
My fa
On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code
wrote:
it differ from assert because it contains the expression, file
and line information. See this
https://stackoverflow.com/questions/14420857/check-expect-example-in-racket
what's the closest thing we have in D? can we make it w
On Thursday, 23 December 2021 at 07:14:35 UTC, Salih Dincer wrote:
It seems faster than algorithms in Phobos. We would love to see
this in our new Phobos.
Replace: 436 msecs
Malloc : 259 msecs
*/
It seems because MallocReplace is cheating a lot:
- it is not called through another function l
On Thursday, 9 May 2019 at 10:09:23 UTC, Cym13 wrote:
Hi,
this is likely not related to D itself but hopefully someone
can help me with this since I'm rather new to windows
programming, I mainly work on linux. I'm trying to bundle a DLL
in a binary, write it in a temp folder, use it and remov
On Friday, 10 May 2019 at 19:10:05 UTC, Machine Code wrote:
Well, I've had similar issue. The error message says "access
denied" which I believe refers to the tmp directory; i.e, the
user that is running your executable has no permissions to
delete that file.
Well, this has nothing to do with
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote:
Hi,
consider this:
interface Base
{
void setup();
}
interface FeatureX
{
void x();
}
class Foo: Base, FeatureX
{
void setup(){};
void x(){};
}
void main()
{
Base foo = new Foo(); // This would be the result of a
factory class
On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote:
On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote:
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote:
That's because foo is of type Base, not implementing FeatureX.
Right, Base isn't implementing FeatureX, but foo is really a Foo
That'
On Thursday, 13 June 2019 at 16:08:52 UTC, Mike wrote:
How would a proper destructor of class Foo look like?
Is it enough to set "array" to null? Or do I have to set every
element of the array to null and then the array, or nothing of
that at all because the garbage collecter collects it, if th
On Friday, 14 June 2019 at 07:52:24 UTC, Marco de Wild wrote:
On Thursday, 13 June 2019 at 16:08:52 UTC, Mike wrote:
Opposed to Java, D's member variables are static initialised.
Is there any documentation about this? I find it unexpected.
Is there any way to overload specific floating point operators?
https://dlang.org/spec/expression.html#floating-point-comparisons
I'm using a decimal data type (a struct) and one of the possible
values is NaN, that's why I need these operators.
I know also that this also was discussed, but is
Is there anyway to extend an existing function to accept custom
data types?
Option 1 - global import of std.math
import std.math;
struct Custom {}
int signbit(T)(T x) if (is(T == Custom))
{
return 0;
}
Custom c;
assert(signbit(c) == 0);
assert(signbit(-1.0) == 1);
Er
On Tuesday, 26 December 2017 at 16:15:55 UTC, Adam D. Ruppe wrote:
The mistake you're making is using a constraint when you should
try a specialization:
int signbit(T:Custom)(T x)
{
return 0;
}
That means to use this specialized function when T is Custom.
Now, you just need to merge the
On Tuesday, 26 December 2017 at 20:21:11 UTC, Adam D. Ruppe wrote:
On Tuesday, 26 December 2017 at 19:41:47 UTC, rumbu wrote:
"Custom" is a templated struct. I cannot imagine all the
instantiations of Custom to write template specialisations for
each of them.
You can specialize on templated s
Is that normal?
use std.math;
float f = float.max;
f += 1.0;
assert(IeeeFlags.overflow) //failure
assert(f == float.inf) //failure, f is in fact float.max
On the contrary, float.max + float.max will overflow. The
behavior is the same for double and real.
Is there any way to parse a format string into a FormatSpec?
FormatSpec has a private function "fillUp" which is not
accessible.
I need to provide formatting capabilities to a custom data type,
I've already written the standard function:
void toString(C)(scope void delegate(const(C)[]) sink
module a;
private import std.math: isNaN;
//custom overload
public bool isNaN(int i) { return false; }
=
module b;
import a;
void foo()
{
bool b = isNaN(float.nan);
//compiles successfully calling std.math.isNaN even it should
not be visible.
}
Is this
On Tuesday, 16 January 2018 at 18:32:46 UTC, H. S. Teoh wrote:
Which version of the compiler is this? I'm pretty sure the
std.math.isNaN imported by module a should not be visible in
module b. The latest compiler should emit a deprecation warning
for this.
2.078, but also 2.077. Deprecation
On Tuesday, 26 December 2017 at 20:21:11 UTC, Adam D. Ruppe wrote:
On Tuesday, 26 December 2017 at 19:41:47 UTC, rumbu wrote:
"Custom" is a templated struct. I cannot imagine all the
instantiations of Custom to write template specialisations for
each of them.
You can specialize on templated s
On Tuesday, 16 January 2018 at 20:30:43 UTC, H. S. Teoh wrote:
On Tue, Jan 16, 2018 at 07:14:00PM +, rumbu via
Even specialized, now I have another problem:
std.math:
int signbit(X)(X x) { ... }
mylibrary:
int signbit(D: Decimal!bits, int bits) { ... }
=
end user:
import
This started in the last DMD version (2.078):
byte b = -10;
ulong u = b < 0 ? -b : b;
//Deprecation: integral promotion not done for `-b`, use
'-transition=intpromote' switch or `-cast(int)(b)
Why do I need a to promote a byte to int to obtain an ulong? Even
in the extreme case where b is by
On Wednesday, 17 January 2018 at 19:54:50 UTC, ag0aep6g wrote:
On 01/17/2018 08:40 PM, rumbu wrote:
This started in the last DMD version (2.078):
byte b = -10;
ulong u = b < 0 ? -b : b;
//Deprecation: integral promotion not done for `-b`, use
'-transition=intpromote' switch or `-cast(int)(b)
And here is why is bothering me:
auto max = isNegative ? cast(Unsigned!T)(-T.min) :
cast(Unsigned!T)T.max);
The generic code above (which worked for all signed integral
types T in 2.077) must be rewritten like this in 2.078:
static if (T.sizeof >= 4)
auto max = isNegative ? cast(Unsigned
On Wednesday, 17 January 2018 at 21:12:07 UTC, Rubn wrote:
On Wednesday, 17 January 2018 at 20:30:07 UTC, rumbu wrote:
And here is why is bothering me:
auto max = isNegative ? cast(Unsigned!T)(-T.min) :
cast(Unsigned!T)T.max);
The generic code above (which worked for all signed integral
typ
On Thursday, 18 January 2018 at 02:30:17 UTC, Rubn wrote:
On Wednesday, 17 January 2018 at 22:30:11 UTC, rumbu wrote:
code like "m = n < 0 ? -n : n" doesn't worth a wrapper
That code is worth a wrapper, it's called "abs"...
m = abs(n);
Well, since I'm in the learn forum and you seem to have
On Thursday, 18 January 2018 at 12:51:48 UTC, Dominikus Dittes
Scherkl wrote:
On Thursday, 18 January 2018 at 06:05:08 UTC, rumbu wrote:
On Thursday, 18 January 2018 at 02:30:17 UTC, Rubn wrote:
On Wednesday, 17 January 2018 at 22:30:11 UTC, rumbu wrote:
code like "m = n < 0 ? -n : n" doesn't
On Thursday, 18 January 2018 at 17:54:59 UTC, rumbu wrote:
On Thursday, 18 January 2018 at 12:51:48 UTC, Dominikus Dittes
target = isNegative ? cast(Unsigned!T)(-c) : cast(Unsigned!T)c;
That would have been better even before the change, because
the operator '-' used on unsigned types is li
On Thursday, 18 January 2018 at 18:00:51 UTC, rumbu wrote:
On Thursday, 18 January 2018 at 17:54:59 UTC, rumbu wrote:
On Thursday, 18 January 2018 at 12:51:48 UTC, Dominikus Dittes
target = isNegative ? cast(Unsigned!T)(-c) :
cast(Unsigned!T)c;
That would have been better even before the
According to this
(https://dlang.org/spec/hash-map.html#static_initialization) this
is correct static initialization for AA:
immutable RoundingMode[string] ibmRounding =
[
">" : RoundingMode.towardPositive,
"<" : RoundingMode.towardNegative,
"0" : RoundingMode.towardZero,
"=0":
On Friday, 19 January 2018 at 23:27:06 UTC, Adam D. Ruppe wrote:
On Friday, 19 January 2018 at 23:16:19 UTC, rumbu wrote:
According to this
(https://dlang.org/spec/hash-map.html#static_initialization)
this is correct static initialization for AA:
That only works inside a function, and, ironic
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote:
Hello all!
I've been doing console apps for about a year and a half now,
but my requirements are reaching the limits of easy to use with
ASCII-based UI and typed commands so I'm thinking of moving
into GUI-era with my projects. I
I know that according to language spec
(https://dlang.org/spec/arrays.html#static-init-static) you can
skip declaring all your elements in a fixed size array.
I'm just recovering from a bug which took me one day to discover
because of this.
I have a large static initialized array, let's say
On Saturday, 10 February 2018 at 12:28:16 UTC, b2.temp wrote:
On Saturday, 10 February 2018 at 10:55:30 UTC, rumbu wrote:
I know that according to language spec
(https://dlang.org/spec/arrays.html#static-init-static) you
can skip declaring all your elements in a fixed size array.
I'm just rec
On Saturday, 10 February 2018 at 14:55:49 UTC, b2.temp wrote:
On Saturday, 10 February 2018 at 14:35:52 UTC, rumbu wrote:
In this case, it there any way to be sure that I declared all
the elements I intended? Obviously, without counting them by
hand.
At the level of the library use a templa
On Sunday, 11 February 2018 at 01:26:59 UTC, psychoticRabbit
wrote:
On Sunday, 11 February 2018 at 01:13:00 UTC, psychoticRabbit
wrote:
Well, in C.. I can do:
int arr[2] = { [0]=10, [1]=20 };
I cannot work out how to do that in D yet (anyone know??)
Oh. just worked it out after reading thi
On Sunday, 11 February 2018 at 14:06:32 UTC, rjframe wrote:
On Sat, 10 Feb 2018 10:55:30 +, rumbu wrote:
If you separate initialization to a static this, you'll get a
compile error:
```
immutable uint256[78] pow10_256;
static this() {
// Error: mismatched array lengths, 78 and 2
On Monday, 12 February 2018 at 03:13:43 UTC, aliak wrote:
Hi,
Is there a way to get post increment and pre increment working
properly in this scenario?
import std.stdio;
struct A {
int[] a;
this(int a) { this.a = [a]; }
auto opUnary(string op)(){
return A(mixin(op ~ "this
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 Sunday, 25 February 2018 at 08:08:30 UTC, psychoticRabbit
wrote:
But umm what happended to the principle of least
astonishment?
writeln(1.1); (prints 1.1)
whereas..
writeln(1.0); (prints 1)
I don't get it. Cause it's 'nicer'??
Because writeln(someFloat) is equivalent to writefln("
On Sunday, 25 February 2018 at 13:33:07 UTC, psychoticRabbit
wrote:
can someone please design a language that does what I tell it!
please!!
is that so hard??
print 1.0 does not mean go and print 1 .. it means go and print
1.0
languages are too much like people.. always thinking for
themsel
On Tuesday, 13 March 2018 at 12:23:06 UTC, Ozan Süel wrote:
Hi
I have a construction like the following
if (source) {
if (source.pool) {
if (source.pool.repository) {
if (source.pool.repository.directory) {
if (source.pool.repository.directory.users) {
// do someth
I know that there are contributing guides but I fail to
successfully follow any of them:
https://wiki.dlang.org/Starting_as_a_Contributor
1. Bash install script will not run under Windows. Using git bash
will result in error (Command error: undefined switch '-C')
2. Digger it's not compiling
On Wednesday, 14 March 2018 at 00:43:52 UTC, Rubn wrote:
Yah it's not fun.
Some notes:
You might need to set MSVC_CC environment variable cause it
doesn't use the right format for VS path, depending on your
version.
https://github.com/dlang/dmd/blob/v2.079.0/src/vcbuild/msvc-dmc.d#L19
You
On Thursday, 15 March 2018 at 17:18:08 UTC, Miguel L wrote:
On Thursday, 15 March 2018 at 16:31:56 UTC, Stefan Koch wrote:
On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote:
Why does std.math.signbit only work for floating point types?
Is there an analogue function for integer types? w
On Monday, 19 March 2018 at 11:35:46 UTC, Dukc wrote:
This topic is technically in wrong place, since the problem is
with C#, not D. But because what I'm asking is more idiomatic
in D than elsewhere, I think I have the best changes to get
understood here.
So, I'm looking for some library, or
On Tuesday, 20 March 2018 at 16:56:59 UTC, Dennis wrote:
On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote:
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote:
I suspect you are seeing the Windows antivirus hitting you. D
runtime starts up in a tiny fraction of a second, you
I tried to define a template:
enum isFoo(alias T) =
T.stringof.length >= 3 && T.stringof[0..3] == "abc";
int i;
pragma(msg, isFoo!i);
Error: string slice [0 .. 3] is out of bounds
Error: template object.__equals cannot deduce function from
argument types !()(string, string), candidates are
On Wednesday, 21 March 2018 at 18:50:38 UTC, Vino wrote:
Hi All,
Request your help in calling the windows command to delete all
file and folders recursively as the D function rmdirRecurse
does not delete file in the permission of the file is readonly
in windows 2008 R2
import std.process:
On Monday, 26 March 2018 at 06:40:34 UTC, Vladimirs Nordholm
wrote:
However I do not understand how to use that with my arguments.
Eg. I would expect to do something like:
void foo(X, Y, Args...)(X x, Y y, Args args)
if(isNumeric!(x) && isNumeric!(y) && args.length >= 1)
{
Is there a standard way to handle errors in a chain of range
transformations?
Let's say I want to read some comma separated numbers from a file.
auto myArray = file.byLine().splitter().map!(to!int).array();
Now, besides fatal errors (like I/O), let's suppose I want to
handle some errors in a
On Thursday, 5 April 2018 at 17:36:56 UTC, Seb wrote:
On Thursday, 5 April 2018 at 17:06:04 UTC, rumbu wrote:
Is there a standard way to handle errors in a chain of range
transformations?
[...]
Are you aware of ifThrown?
https://dlang.org/phobos/std_exception.html#ifThrown
It's not perfect
My opinion is to use the Tango's unicodedata.d module to obtain
the unicode category, std.uni does not provide such functionality.
This module does not have any dependency, therefore you can just
use it directly:
https://github.com/SiegeLord/Tango-D2/blob/d2port/tango/text/UnicodeData.d#L169
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote:
I'm writing a talk for codemesh on the use of D in finance.
Any other thoughts?
For finance stuff - missing a floating point decimal data type.
Things like 1.1 + 2.2 = 3.3003
On Saturday, 31 October 2015 at 15:42:00 UTC, tcak wrote:
On Saturday, 31 October 2015 at 14:37:23 UTC, rumbu wrote:
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc
wrote:
I'm writing a talk for codemesh on the use of D in finance.
Any other thoughts?
For finance stuff - missing a
On Saturday, 31 October 2015 at 20:55:33 UTC, David Nadlinger
wrote:
On Saturday, 31 October 2015 at 18:23:43 UTC, rumbu wrote:
My opinion is that a decimal data type must be builtin in any
modern language, not implemented as a library.
"must be builtin in any modern language" – which modern
On Wednesday, 4 November 2015 at 12:25:31 UTC, Laeeth Isharc
wrote:
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote:
I'm writing a talk for codemesh on the use of D in finance.
Sorry - I wrote this in a hurry, and I should have said on my
experience of using D in finance (not
Let's say that I'm a library provider and I intend to offer a
completely new data type suitable for printing with format() or
writef().
According to this tutorial
(http://wiki.dlang.org/Defining_custom_print_format_specifiers),
to achieve this, one must import at least std.format : FormatSpec
On Monday, 9 November 2015 at 16:11:23 UTC, H. S. Teoh wrote:
On Mon, Nov 09, 2015 at 03:09:26PM +, rumbu via
Digitalmars-d-learn wrote:
[...]
Do you need *custom* format specifiers? If all you need is to
be able to write: format("%s", myData), then the only thing you
need t
On Friday, 20 November 2015 at 11:16:13 UTC, userABCabc123 wrote:
Does someone have a good CTFE fmod() function ? The problem is
that std.math.fmod() is itself not available at CT, neither do
floor() or similar functions necessary to get the quotient when
the input value is two times over/under
On Monday, 7 December 2015 at 08:17:27 UTC, Enjoys Math wrote:
Exception Message:
First-chance exception: std.format.FormatException Unterminated
format specifier: "%" at
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(828)
[CODE]
module set;
import std.conv;
struct Set(T) {
stri
On Friday, 11 December 2015 at 06:28:09 UTC, Shriramana Sharma
wrote:
Hello. I'm trying to figure out how to use
FloatingPointControl.enableExceptions. Upon enabling
severeExceptions I would expect the division by zero to be
signaled, but neither do I get a SIGFPE nor does ieeeFlags show
the e
On Sunday, 13 December 2015 at 18:54:24 UTC, Robert M. Münch
wrote:
Hi, I just wanted to naively copy an object and used:
a = myobj.dup;
[...]
A naive clone method for objects:
https://github.com/rumbu13/sharp/blob/c34139449a078618e807a3f206541656df1bea6a/src/system/package.d#L46
On Monday, 21 December 2015 at 09:44:20 UTC, Shriramana Sharma
wrote:
Hello. I want to define a template specialization using traits:
import std.stdio, std.traits;
void func(T)(T t) { writeln(1); }
void func(T)(T t) if(isIntegral!T) { writeln(2); }
void main()
{
func(1);
}
But I'm getting a
On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman
wrote:
Sorry if this is a silly question but is the to! method from
the conv library the most efficient way of converting an
integer value to a string?
e.g.
string s = to!string(100);
I'm seeing a pretty dramatic slow down in my cod
On Tuesday, 22 December 2015 at 19:45:46 UTC, Daniel Kozák wrote:
V Tue, 22 Dec 2015 18:11:24 +
rumbu via Digitalmars-d-learn
napsáno:
On Tuesday, 22 December 2015 at 17:15:27 UTC, Andrew Chapman
wrote:
> Sorry if this is a silly question but is the to! method from
> the conv l
1 - 100 of 160 matches
Mail list logo