On 20.04.2016 22:09, Matt Kline wrote:
I'd rather not write my own cURL wrapper. Do you think it would be
worthwhile starting a PR for Phobos to get it changed to ubyte[]? A
reading of https://dlang.org/spec/arrays.html indicates the main
difference is that that GC crawls void[], but I would
On 20.04.2016 21:48, Matt Kline wrote:
I don't have an option here, do I? I assume HTTP.onSend doesn't take a
`delegate size_t(ubyte[])` insetad of a `delegate size_t(void[])`, and
that the former isn't implicitly convertible to the latter.
Maybe I've missed it, but you didn't say where the
On 20.04.2016 19:09, Matt Kline wrote:
1. What is the idiomatic way to constrain the function to only take char
ranges? One might naïvely add `is(ElementType!T : char)`, but that falls
on its face due to strings "auto-decoding" their elements to dchar.
(More on that later.)
Well, string is not
On 17.04.2016 13:00, denizzzka wrote:
So, my problem is solved. But nevertheless maybe here is a problem in
the compiler too.
I've reduced the test case and filed an issue:
https://issues.dlang.org/show_bug.cgi?id=15936
On 15.04.2016 20:55, Eric wrote:
13 class C : const (I!(J))
I think this const is ignored by the compiler.
15F!(J) m;
A little tip: You can omit the parentheses of template instantiations
when the argument is a single identifier. That is, `F!(J)` can be
written as `F!J`.
On 15.04.2016 19:13, Eric wrote:
1 alias J = const C;
2
3 void main(string[] args)
4 {
5 J a = new C();
6 I!(J) i = a;
7 }
8
9 interface I(V) { }
10
11 class F(V) if (is(V : I!(V))) { }
12
13 class C : I!(J)
14 {
15 F!(J) m;
16 }
The above
On 14.04.2016 12:39, pineapple wrote:
I've had success running unit tests on OSX by running `rdmd --main
-unittest [file]` but have had no such luck on Windows. The
aforementioned command fails,
Should work. If you can go into more detail as to how it fails, maybe we
can figure out what's
On 10.04.2016 20:45, Joseph Rushton Wakeling wrote:
One very basic idea is to allow graph edges to have arbitrary
properties, and to do that, I've tried to come up with a basic data
structure that can be extended via variadic template arguments.
However, I'm not entirely satisfied with the
On 11.04.2016 00:06, Manuel Maier wrote:
So, is this a bug, or is it intended behavior? In case of the latter,
I'd gladly add it to the documentation.
Looks like a bug to me. And it's already been filed:
https://issues.dlang.org/show_bug.cgi?id=13392
On Saturday, 9 April 2016 at 19:31:31 UTC, Uranuz wrote:
I think that we need to add warning about such case in
documentation section:
https://dlang.org/spec/hash-map.html#construction_and_ref_semantic
in order to prevent this kind of mistakes in code.
Isn't that exactly what the section you
On Saturday, 9 April 2016 at 19:25:32 UTC, Uranuz wrote:
Another observation is illustrated with the foloving code:
http://dpaste.dzfl.pl/8d68fd5922b7
Because AA and arrays are not created before they were assigned
some value it leads to inconsistency in behavior. And will
produce unexpected
On Saturday, 9 April 2016 at 18:06:52 UTC, Uranuz wrote:
Thanks. It's clear now. AA holds not `array struct` itself
inside, but pointer to it.
How the array is stored in the AA doesn't matter, as far as I can
see. The point is that you obtain a pointer to the array struct
in the AA, not a
On 09.04.2016 18:13, Uranuz wrote:
http://dpaste.dzfl.pl/523781df67ab
For reference, the code:
import std.stdio;
void main()
{
string[][string] mapka;
string[]* mapElem = "item" in mapka; //Checking if I have item
if( !mapElem )
On 09.04.2016 18:07, pineapple wrote:
What's different between these two examples, practically speaking? When
would you use one over the other?
struct thing1{
const int x, y;
}
struct thing2{
int x, y;
}
In this case, const is practically the same as immutable. But immutable
is
On 09.04.2016 10:45, alexander Patapoff wrote:
is there a way for me to do this in D? In java, one is able to create a
new instance of an interface.
interface Action
{
void actions(T t);
}
class testAction
{
this()
{
Action action = new Action()
{
void
On 08.04.2016 14:04, Voitech wrote:
template MixinTypeIterate(alias mixinTemplate,TList...){
[...]
}
how to alias mixin template to be able to pass it to this one ?
class BaseClass(T){
protected alias Types=AliasSeq!(int,string,ubyte);
private alias WrappedMix(S)=mixin Mix!(T,S);
On 07.04.2016 14:57, rikki cattermole wrote:
Ugh, 2.070.2 definitely has it still.
I have no idea when that changed
I don't think """...""" ever was a thing. You could definitely put
newlines in normal "..." literals since basically forever. And
concatenation of adjacent "..." literals
On 07.04.2016 13:59, rikki cattermole wrote:
"abc" strings are not multiline.
Use """abc""" for that purpose.
Wat. We're talking about, aren't we? In D, "abc" strings are multiline,
and """abc""" is not a thing. `"""abc"""` is the same as `"" "abc" ""`
is the same as `"" ~ "abc" ~ ""` is the
On 05.04.2016 20:44, Thalamus wrote:
import core.stdc.stddef; // For wchar_t. This is defined differently for
Windows vs POSIX.
import core.stdc.wchar_; // For wcslen.
Aside: D has syntax for "// For wchar_t.": `import core.stdc.stddef:
wchar_t;`.
wstring toWstring(wchar_t* value)
{
On 05.04.2016 13:35, pineapple wrote:
alias somelongsignature = int(in int x);
alias somelongsignature = int function(in int);
Or if you want to accept methods and such:
alias somelongsignature = int delegate(in int);
You can name the parameter, but it won't be part of the type.
int
On 30.03.2016 20:12, jmh530 wrote:
I wrote a version of cartesianProduct that will return the cartesian
product when the some of the types are not ranges. The original code is
below.
My issue is that I can't figure out how to turn it into a variadic
template. The latest thing I tried is:
auto
On 31.03.2016 07:40, Jack Stouffer wrote:
$ ldc2 -O3 -release -boundscheck=off test.d
$ ./test
auto-decoding1 sec, 757 ms, and 946 μs
byCodeUnit87 ms, 731 μs, and 8 hnsecs
byGrapheme14 secs, 769 ms, 796 μs, and 6 hnsecs
So the auto-decoding version takes about twenty
On 30.03.2016 19:30, Jack Stouffer wrote:
Just to drive this point home, I made a very simple benchmark. Iterating
over code points when you don't need to is 100x slower than iterating
over code units.
[...]
enum testCount = 1_000_000;
enum var = "Lorem ipsum dolor sit amet, consectetur
On 30.03.2016 15:44, Nordlöw wrote:
On Wednesday, 30 March 2016 at 13:24:20 UTC, ag0aep6g wrote:
[...]
This is off topic, but don't mark templates like that @trusted. By
doing so you also trust R, but you don't know if it's memory safe.
Should I post in group "General" instead?
No, no, I
On 30.03.2016 15:12, Nordlöw wrote:
https://github.com/nordlow/justd/blob/master/packedarray.d
From there:
this(R)(R values, bool assumeSortedParameter = false) @trusted nothrow
@("complexity", "O(n*log(n))")
if (isInputRange!R)
This is off topic, but don't mark templates like
On 29.03.2016 00:49, Jack Stouffer wrote:
But the value fits into a char; a dchar is a waste of space. Why on
Earth would a different type be given for the front value than the type
of the elements themselves?
UTF-8 strings are decoded by the range primitives. That is, `front`
returns one
On 26.03.2016 18:04, ag0aep6g wrote:
https://gist.github.com/aG0aep6G/a1b87df1ac5930870ffe/revisions
PS: Those enforces are for a size of 100_000 not 1_000_000, because I'm
impatient.
On 26.03.2016 17:31, ag0aep6g wrote:
Let the output depend on the results somehow. Simply printing them out
should do the trick. You can also try throwing an Exception on wrong
results. Else the calculations will be optimized away completely.
Also make sure that data that's supposed to be
On 26.03.2016 14:47, maik klein wrote:
The problem I have is that LDC always seems to optimize the functions
too much. At least one function executes always in "1 hnsec".
Let the output depend on the results somehow. Simply printing them out
should do the trick. You can also try throwing an
On 24.03.2016 00:44, ag0aep6g wrote:
On 24.03.2016 00:26, cy wrote:
++items.length
move(items[$-1],item); // Error: struct Thing is not copyable because it
is annotated with @disable
You got the order of arguments wrong here. Source goes first, target
second. Works for me with `move(item,
On 24.03.2016 00:26, cy wrote:
++items.length
move(items[$-1],item); // Error: struct Thing is not copyable because it
is annotated with @disable
You got the order of arguments wrong here. Source goes first, target
second. Works for me with `move(item, items[$-1]);`.
On 23.03.2016 22:26, ag0aep6g wrote:
On 23.03.2016 22:18, cy wrote:
On Wednesday, 23 March 2016 at 21:10:49 UTC, ag0aep6g wrote:
[...]
b = new int(*b + 1);
Here "b" is pointing to mutable heap allocated data, which got cast to
constant.
with b = b + 1, it's still constant memory.
It's
On 23.03.2016 22:18, cy wrote:
On Wednesday, 23 March 2016 at 21:10:49 UTC, ag0aep6g wrote:
[...]
b = new int(*b + 1);
Here "b" is pointing to mutable heap allocated data, which got cast to
constant.
with b = b + 1, it's still constant memory.
It's stack memory. Its constness isn't any
On 23.03.2016 21:52, cy wrote:
const(int)[2] a = [23,24];
const(int)* b = a;
Should be: const(int)* b = a.ptr;
writeln(," always constant");
writeln(a, " always constant");
There's some subtlety here. `a` itself is not const, but its elements
are. `a` being a fixed-sized array, you can't
On 22.03.2016 16:56, ag0aep6g wrote:
I've filed an issue: https://issues.dlang.org/show_bug.cgi?id=15821
And it's been fixed:
https://github.com/D-Programming-Language/druntime/pull/1519
Since the issue was a regression, the fix was made against the stable
branch. It's going to be in the
On 20.03.2016 08:49, stunaep wrote:
The gc throws invalid memory errors if I use Arrays from std.container.
For example, this throws an InvalidMemoryOperationError:
import std.stdio;
import std.container;
void main() {
new Test();
}
class Test {
private Array!string test =
On 21.03.2016 11:19, ZombineDev wrote:
DFLAGS=-I~/dev/repos/dlang/druntime/import -I~/dev/repos/dlang/phobos
-L-L/home/zombinedev/dev/repos/dlang/phobos/generated/*/release/64
[...]
Linking...
...
/usr/bin/ld {other stuff...}
-L/home/zombinedev/dev/repos/dlang/phobos/generated/*/release/64
On 19.03.2016 21:24, szymski wrote:
In my opinion should give different addresses for each
instance of A, because it's not static. What am I doing wrong? Thanks in
advance.
The As are different, but they all reference the same B. Initialize b in
a constructor instead.
On 14.03.2016 09:42, John wrote:
module one;
struct Test(T) {}
void testing(T)(Test!T t) {}
module two;
struct Test(T : int) {}
void main() {
Test!int i;
testing!int(i);
}
Output:
error : testing (Test!int t) is not callable using argument types
(Test!int)
On 12.03.2016 16:44, Mike Parker wrote:
arr[] = cast(Nullable!uint)1;
Nicer than a cast: construct a Nullable!int.
arr[] = Nullable!uint(1);
On 11.03.2016 23:47, WhatMeWorry wrote:
--- main.d
void main(string[] argv)
{
ResourceManager.LoadShader("VertexShader.glsl",
"FragmentShader.glsl", "filler", "sprite");
--- File ResourceManager.d
On 09.03.2016 10:57, Guillaume Piolat wrote:
Another question that ensues is: will the compiler prevent incorrect use
of pure, so that it's safe to spam it in your code?
The compiler should catch wrong usage of `pure`, yes. Function
declarations without implementation are an exception, of
On 09.03.2016 10:56, Guillaume Piolat wrote:
If I understand purity correctly
(http://klickverbot.at/blog/2012/05/purity-in-d/), every function out
there can be marked pure as long as it doesn't modify globals, shared
variables or do I/O?
Pure functions also can't *read* mutable globals. But
On 03.03.2016 07:12, Shriramana Sharma wrote:
string ta(string s) { return s ~ "1"; }
template ta(string s) { enum ta = ta(s); }
In `ta(s)` here, `ta` is the enum itself again. It's similar to `int x =
x;`. Can't do that, of course.
Add a leading dot to refer to the module level `ta`
On 01.03.2016 22:30, Tamas wrote:
struct Tag {}
template isTagged(S) {
enum bool isTagged =
delegate() {
foreach(attr; __traits(getAttributes, S)) {
static if (is(attr == Tag)) {
return true;
}
}
On 01.03.2016 14:35, Andrea Fontana wrote:
This very very simple function [1] won't compile.
It says that param t is not nothrow. Why? What's wrong with this?
http://dpaste.dzfl.pl/bfc382e62711
It's a bug. Lazy parameters generate delegates. nothrow is currently not
inferred for those
On 29.02.2016 12:06, Suliman wrote:
On Windows next code work fine:
int len = fullimgurl.length;
On Linux DMD get error that:
Error: cannot implicitly convert expression (fullimgurl.length) of type
ulong to int
Why on every OS length have different size?
On Windows, the compiler flag -m32 is
On 28.02.2016 00:29, mahdi wrote:
I read this criticism about D on Reddit and it claims that you cannot
use strings in mixins. Can you please elaborate about this and the
reason behind it?
QUOTE:
Look at strings: they are defined as immutable(char []).
immutable(char)[] actually
"immutable"
On 25.02.2016 14:33, Nicholas Wilson wrote:
Note that D has zero based array indexing
so assuming your array has 100 elements history[1..100]
is going one past the end of the array.
No, that's fine. `history[1..100]` gives you 99 elements starting at
index 1, i.e. all except the first one.
On 22.02.2016 23:56, Andre wrote:
I was wondering how people in this D community think about the number of
issues with NEW status...
It could scare individuals/organizations to start with D, when they get
the impression that there are a large and growing number of issues that
are open (for
701 - 750 of 750 matches
Mail list logo