On 06/02/2016 10:11 PM, Alex wrote:
The cool thing about the Algebraic is as I expected, that it doesn't
change it's type... And the hard thing is, that I'm not used to its
Empty, Many, ... things yet.
I just made those up on the spot. Note that Many is not actually
implemented at all. There
On 06/02/2016 11:37 PM, Alex wrote:
Just tried this instead of your f-function:
void f(int[] arr)
{
A result;
import std.meta;
alias TL = AliasSeq!(Empty, int, Many!int);
int caseS;
switch (arr.length)
{
case 0: result = Empty.init; caseS = 0; break;
On 06/03/2016 04:34 PM, John Nixon wrote:
import std.stdio;
import std.container;
struct CS{
char[] t;
CS dup()const{
CS cs;
cs.t = this.t.dup;
return cs;}
};
Aside: No semicolon after struct declarations in D.
void main(){
Array!CS cs_array = make!(Array!CS)();
On 06/03/2016 01:35 AM, ag0aep6g wrote:
The alternative `peek` method is not documented to throw an exception,
but it's not @nogc either. No idea why. Maybe Algebraic does GC
allocations internally. I wouldn't know for what, though. Or it misses a
@nogc somewhere.
I've looked at the source to
On 06/03/2016 01:17 AM, Alex wrote:
But still, I can't mark the f-method @nogc, and this is not due to the
writeln calls... why GC is invoked, although everything is known and no
memory allocation should happen?
It's the Algebraic. The `get` method isn't @nogc. The documentation [1]
says that
On 06/03/2016 10:06 PM, chmike wrote:
If I have a static immutable object, I don't have to declare it as
shared because it is implicit. Right ?
Right.
[...]
1. question
---
I had a __gshared Info[N] infos_; that I fill in a static this() method.
Should be filling it in a `shared
On 06/05/2016 08:02 PM, Suliman wrote:
I really can't understand why try-catch block do not handle exception.
digit 1 is printing, so exception is accrue after it, but why nothing in
catch block?
http://img.ctrlv.in/img/16/06/05/57546861d8e81.png
Here is my code:
void dbSetup()
{
try
On 06/07/2016 08:50 PM, ParticlePeter wrote:
On Tuesday, 7 June 2016 at 14:31:40 UTC, Alex Parrill wrote:
I don't think opCast gets called for implicit conversions; it only
gets called for explicit casts. I'll test it later.
It does for type bool, but I fear that's the only exception.
No,
On 06/08/2016 12:02 AM, cy wrote:
import std.stdio;
void foo(Callable)(Callable bar) {
bar();
}
void foo2(Callable)(Callable bar, int baz) {
bar(baz);
}
void main() {
foo({
writeln("okay");
});
foo2((bar) {
writeln("got",bar);
},42);
foo2((bar) =>
On 06/11/2016 01:59 PM, yawniek wrote:
i forgot to add a few important points:
- the strings in vec_t are not c strings
- vec_t might contain other data than strings
the original ctor i pasted actually doesn't even work, temporarly i
solved it like
this(string s) {
char[] si =
On 06/06/2016 11:25 PM, Alex Parrill wrote:
You might be able to get away with casting the const away, if you are
sure it won't modify the hash or equality check.
Casting away const and then mutating has undefined behavior. The
compiler is free to assume that it doesn't happen.
Be aware
On 06/04/2016 05:02 PM, chmike wrote:
Is it possible to instantiate immutable objects by using emplace
Yes. I'm not sure, but the memory may have to be untyped for the emplace
call to avoid mutating immutable data. I.e., call emplace with void[],
not with a pointer whose target is already
On 05/28/2016 09:54 PM, chmike wrote:
The only inconvenience left is that we can't have mutable references
to immutable objects.
There is std.typecons.Rebindable for that.
On 05/28/2016 10:34 AM, Mike Parker wrote:
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
[...]
Is a static const Category c variable a TLS variable ?
Yes. All variables are TLS unless explicitly marked with __gshared or
shared.
I don't think that's true.
import core.thread;
On 05/28/2016 02:43 PM, Lodovico Giaretta wrote:
struct S1
{
int doSomething() @safe
{
// do something safely
return 1;
}
}
struct S2
{
int doSomething() @system
{
// do something usafe
return 2;
}
}
auto doSomethingDumb(T)(ref
On 05/28/2016 06:09 PM, chmike wrote:
In the following instruction of the above commit, what effect has the []
after init ?
_store[0 .. __traits(classInstanceSize, T)] = typeid(T).init[];
T is a template argument that is a class derived from Error.
I couldn't find an explanation here
On 05/29/2016 10:40 PM, qznc wrote:
bool string_cmp_opt(immutable(ubyte)[] x, immutable(ubyte)[] y) {
Having "string" in the function name may be a bit misleading. This
doesn't have any special functionality for text/characters/Unicode, does it?
Should have const parameters, not immutable.
On 05/26/2016 05:28 PM, ArturG wrote:
On Thursday, 26 May 2016 at 15:25:26 UTC, ag0aep6g wrote:
[...]
What does it matter?
You would have to create special cases for them.
When? If you want to check if something is the .init value, compare
against .init.
On 05/26/2016 04:03 PM, ArturG wrote:
for example:
if(any floatingpoint.init) will be true
if(any char.init) also true
if("") also true
while others are false e.g.
string s;
if(s) will be false
all others are also false or did i miss any?
What does it matter?
On 06/02/2016 03:37 PM, Alex wrote:
The question is, how to define the same thing for ranges. What I started
with is:
import std.range : iota;
alias MrSlice = typeof(iota(M.init));
so far, so good. The MrSlice-thing is the analogy for Mr, as it can be
empty, as Mr can.
What I also need is the
On 06/02/2016 04:59 PM, Ali Çehreli wrote:
'alias this' with property functions work at least for your example:
struct FixedRangeInt {
int min;
int max;
int i_;
int value() const {
return i_;
}
void value(int i) {
assert(i >= min);
On 06/02/2016 05:16 PM, Alex wrote:
What I mean is: if there would be a possibility to use algebraic types
here (or maybe some kind of template...), then my types would be able
(maybe! did not seen anything similar yet...) to choose the proper
methods for themselves automatically:
As long as my
On 05/26/2016 11:13 PM, Era Scarecrow wrote:
By adding a struct overload for opOpAssign I can shrink it all down
to this, and avoid lengths entirely... As such internally the length
starts at 0, and checks are in place to ensure the bounds are never
exceeded.
void scan(ref Data[][] data,
On 05/26/2016 09:51 AM, Era Scarecrow wrote:
So I'm experimenting and want to override how arrays are managed for a
short duration, this is for optimization of not having to make another
array to keep track of lengths and then shorten them when i can in fact
just manage it myself *very*
On 06/21/2016 10:48 PM, Lodovico Giaretta wrote:
struct Wrapper(T)
{
private T wrapped;
template hasAssignableProperty(string name, Arg)
{
enum bool hasAssignableProperty = is(typeof(
(ref T val, ref Arg arg)
{
On 06/19/2016 12:45 PM, Gary Willoughby wrote:
On Sunday, 19 June 2016 at 10:35:59 UTC, Gary Willoughby wrote:
...
A more correct example:
import core.stdc.stdlib;
import std.traits;
ref T foo(T)()
{
alias Type = Unqual!(T);
Type* foo = cast(Type*) malloc(Type.sizeof * 8);
On 06/19/2016 11:19 PM, Joerg Joergonson wrote:
On Sunday, 19 June 2016 at 20:21:35 UTC, ag0aep6g wrote:
[...]
No. B!b is derived from A!b, not from A!a. `b` being derived from `a`
does not make A!b derived from A!a.
why not? This doesn't seem logical!
Template parameters simply don't work
On 06/19/2016 09:59 PM, Joerg Joergonson wrote:
This should be completely valid since B!T' obviously derives from A!T
directly
ok
and we see that T' derives from b which derives from a
directly.
ok
So B!b is an entirely derived from A!a
No. B!b is derived from A!b, not from A!a. `b`
On 06/20/2016 01:40 AM, Joerg Joergonson wrote:
public class Button(T : ButtonItem) : Widget { ... }
public class ButtonItem : Item
{
void Do() { auto parent = (cast(Button!ButtonItem)this.Parent); }
...
}
All this works great! As long as Do is not being called from a derived
class
public
On Saturday, 18 June 2016 at 17:02:40 UTC, Joerg Joergonson wrote:
3. can't use canFind from algorithm. Complains it can't find a
matching case. I tried many variations to get this to work.
canFind takes a range. Array isn't a range itself, but you can
get one by slicing it with []:
On 06/18/2016 04:37 PM, Gary Willoughby wrote:
Here I'm testing T is either a class or interface:
void foo(T)(T bar) if (is(T == class) || is(T == interface))
{
...
}
Is there a more elegant way of testing T for multiple types? Because it
doesn't scale well if I need to add more.
I would
On 06/26/2016 05:37 PM, Smoke Adams wrote:
system("cls") works but executeShell doesn't. system is depreciated.
Unsolicited spelling correction: no 'i' in "deprecated".
What's going on? The docs say that it creates a new process. I simply
want to clear the console!
`system` directly prints
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 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 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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 24.04.2016 13:03, Lass Safin wrote:
// Omitting the required imports.
void[] ptr;
void main() {
uint buffer;
glCreateBuffers(1, );
// Filling the buffer with data and such...
ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT |
GL_MAP_PERSISTENT_BIT |
On 23.04.2016 03:11, Ramon wrote:
mmm, I figured the problem, but don't know how to solve it.
my struct has a destructor which clears itself:
struct json_value
{
~this() { .ValueClear(); }
}
So the struct is destroyed at the end of DoDirSearch, despite there
being a closure for it. Is the
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 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 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 22.04.2016 13:46, Jeff Thompson wrote:
The function literal also works if I add
"function int[]()":
void main(string[] args) {
immutable int[] array = function int[]() {
int[] result = new int[10];
result[0] = 1;
return result;
}();
}
I take it you're on 2.070 or older
On 22.04.2016 13:07, Jeff Thompson wrote:
OK, we lose the compiler check for correctness. What if I put func
directly in main with the hopes that the compiler will check correctness
and also inline the function? But it won't assign to the immutable
array. Why not? It's the same function.
void
On 21.04.2016 19:10, jacob wrote:
private void runner(T)()
{
shared(T*) s = receiveOnly!(shared(T*))();
This tries to receive a `shared(S!(M, 2)*)`.
writeln(s.x.length);
writeln(s.x[0]);
send(thisTid, true);
Aside: Should be `ownerTid` here, no?
}
int main(string[]
On 27.04.2016 21:40, xtreak wrote:
import std.array;
import std.range;
import std.algorithm;
import std.stdio;
T test(alias f, T)(T num) {
return f(num);
}
T test1(T, V)(T num, V f){
return f(num);
}
void main() {
writeln("hello world");
writeln(1.iota
.map!(a =>
On 27.04.2016 13:06, Nordlöw wrote:
/** Returns: a `string` containing the definition of an `enum` named
`name` and
with enumerator names given by `Es`, optionally prepended with
`prefix` and
appended with `suffix`.
TODO Move to Phobos std.typecons
*/
string
On 26.04.2016 15:35, Begah wrote:
Nothing will reload.
An example :
I load a texture "button.png" in a class and draw it to the screen,
When the screen switches to another screen ie from menu to the game,
I want that the "button.png" texture is automaticly destroyed by the gc.
But this will
On 23.04.2016 07:35, ag0aep6g wrote:
So the struct is destroyed at the end of DoDirSearch, despite there
being a closure for it. Is the compiler doing the right thing here?
Shouldn't the struct be considered alive until the closure gets garbage
collected?
I've filed an issue:
On 23.04.2016 21:49, xtreak wrote:
I am a D newbie from Python and I am trying to grok alias. Is alias like
Python does as below
L = []
myextend = L.extend
L.myextend
My Python isn't too great, but I think this is more similar to function
pointers or delegates in D.
Renaming imported
On 30.04.2016 21:08, Jon D wrote:
If an initial step is to fix the documentation, it would be helpful to
include specifically that it doesn't work with characters. It's not
obvious that characters don't meet the requirement.
Characters are not the problem. remove works fine on a range of
On 30.04.2016 18:44, TheGag96 wrote:
I was just writing some code trying to remove a value from a character
array, but the compiler complained "No overload matches for remove", and
if I specifically say use std.algorithm.remove() the compiler doesn't
think it fits any definition. For reference,
On 30.04.2016 21:41, Jon D wrote:
I didn't mean to suggest making the documentation technically incorrect.
Just that it be helpful in important cases that won't necessarily be
obvious. To me, char[] is an important case, one that's not made obvious
by listing the hasLvalueElements constraint by
On 05/20/2016 08:23 PM, Jack Applegame wrote:
You can just cast const away:
struct A {
int id = 0;
this(int id) {
this.id = id;
}
void change() const {
(cast() id)++;
}
}
That's not a valid D program, though.
On 05/21/2016 06:54 AM, Bauss wrote:
When I then compile with dub build I get this error:
Selected package diamond 0.1.0 does not match the dependency
specification >=0.2.1 <0.3.0 in package diamondtest. Need to "dub upgrade"?
Have you tried "dub upgrade"?
On 05/21/2016 07:15 AM, Bauss wrote:
On Saturday, 21 May 2016 at 05:03:14 UTC, ag0aep6g wrote:
On 05/21/2016 06:54 AM, Bauss wrote:
When I then compile with dub build I get this error:
Selected package diamond 0.1.0 does not match the dependency
specification >=0.2.1 <0.3.0 in package
On 05/23/2016 08:10 PM, cy wrote:
I was squinting at the std.typecons.NullableRef code and it _looks_ like
isNull is only checked at runtime (and not checked at all in release
mode!) but D has surprised me before in its ability to pre-calculate
stuff during compilation.
NullableRef is little
On 05/24/2016 03:59 AM, Jack Stouffer wrote:
parse!int(splitValue.front);
[...]
std.conv.parse(Target, Source)(ref Source s) if (
isSomeChar!(ElementType!Source) && isIntegral!Target && !is(Target
== enum))
You're missing that `parse`'s parameter is `ref`. `splitValue.front` is
On 05/19/2016 03:05 PM, chmike wrote:
I'm planning to call some posix functions core.sys.posix that may set
the errno value in case of error. e.g. read() or write().
Checking the std.exception documentation I see that ErrnoException may
be thrown when errors setting errno may occur. Does this
On 05/19/2016 05:09 PM, Michael wrote:
Any idea what causes this to occur when optimising? I wanted to try and
speed up a simulation I'm running but it just produces too many
unexpected consequences.
I suspect that you're seeing issue 16027 [1], a bad bug in 2.071.0. The
upcoming 2.071.1
On 05/19/2016 05:04 PM, chmike wrote:
interface AThing { ??? string name ??? }
class OneThing : AThing { ??? string name ??? "OneThing" ??? }
class OtherThing : AThing { ??? string name ??? "OtherThing" ??? }
void main()
{
// Accessing name as static information
writeln(OneThing.name
1 - 100 of 646 matches
Mail list logo