On Tuesday, 31 March 2015 at 11:51:26 UTC, drug wrote:
import std.datetime;
import std.stdio;
void main()
{
long.max.SysTime.toISOExtString.writeln;
}
dmd 2.065 (dpaste.dzfl.pl):
+29228-09-14T02:48:05.4775807
dmd v2.067-devel-c6b489b (using Digger):
-29227-04-20T00:11:54.5224191
On Thursday, 26 March 2015 at 16:19:17 UTC, Dmitri Makarov wrote:
When I compile version DOES_NOT_WORK, I get the following error:
c/tool.d(13): Error: variable name cannot be read at compile
time
c/tool.d(13):while looking for match for
hasMember!(Tool, name)
However, the other
On Sunday, 29 March 2015 at 19:13:32 UTC, bitwise wrote:
Interesting, but I still don't understand why D doesn't have
something like this:
const Test test;// or const(Test) test;
test = new Test() // fine, underlaying data is const, the
reference is not
Test const test = new Test();
On Sunday, 29 March 2015 at 18:43:32 UTC, bitwise wrote:
I'm a little confused at this point why this doesn't work
either:
const(Test) test = new Test(); // fine
test = new Test(); // error
In C++, There is a clear distinction:
const Test *test1 = nullptr; // const
On Sunday, 29 March 2015 at 20:29:50 UTC, bitwise wrote:
3) It's not how C++ rolls.
`const Test test;` and `Test const test;` are equivalent in
C++. You need that '*' in C++, too, to make a distinction
between reference and data.
I'm a little confused. I was comparing a C++ pointer-to-class
On Friday, 27 February 2015 at 11:04:51 UTC, Nordlöw wrote:
Is there a more compact way to describe the opCmp function in
the following struct
struct Hit
{
size_t count; // number of walkers that found this node
NWeight rank; // rank (either minimum distance or maximum
strength)
On Tuesday, 3 March 2015 at 07:26:13 UTC, ketmar wrote:
hi.
the following (manually dustmited ;-)) code gives the error
from subj
on git HEAD:
=== ztest.d ===
module ztest;
auto streamAsRange(STP) (STP st) {
static struct StreamRange(ST) {
private:
ST strm;
public:
On Tuesday, 3 March 2015 at 13:42:09 UTC, Stefan Frijters wrote:
So this is a strange thing I ran into while trying to
streamline some templates in my code, where fixed-length arrays
are passed as runtime arguments. I started out by trying
variant fun2(), which disappointingly didn't work.
On Wednesday, 25 February 2015 at 07:07:00 UTC, Ola Fosheim
Grøstad wrote:
On Wednesday, 25 February 2015 at 00:12:41 UTC, anonymous wrote:
[...]
That sounds more attractive than the provided example, but the
right thing to do is to establish proper encapsulation. That
means you need a
On Wednesday, 25 February 2015 at 19:32:50 UTC, Namespace wrote:
void glCheck(lazy void func, string file = __FILE__, uint line
= __LINE__) {
func();
glCheckError(file, line);
}
How can I specify that 'func' is @nogc? Or can define the
function otherwise?
First of
On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
Is this possible?
Example:
void foo(Args...)(auto ref Args args) {
sprintf(str.ptr, fmt.ptr, args);
}
yes
On Thursday, 26 February 2015 at 10:15:07 UTC, Ola Fosheim
Grøstad wrote:
On Wednesday, 25 February 2015 at 22:59:01 UTC, anonymous wrote:
rule-breaking that's going on there. A public trusted_malloc
would invite the un-initiated to shoot their feet.
That's entirely social...
Sure.
A
On Thursday, 26 February 2015 at 10:55:40 UTC, Jonathan M Davis
wrote:
I think that it was the same page, though I could be
remembering wrong.
Several articles are missing as well (e.g. the one on
std.datetime and the
one on arrays), so I don't know how careful they really were in
updating the
On Thursday, 26 February 2015 at 20:56:52 UTC, Ola Fosheim
Grøstad wrote:
But it should matter, because when you mark a unit @trusted you
basically are signing off a certificate that says it acts
like @safe in @safe code. How can you verify anything if you
allow injections?
If you allow
On Saturday, 21 February 2015 at 13:41:41 UTC, Foo wrote:
Finally, I tried to take your criticism objectively and, as far
as I can tell, I resolved the issues. Is there still any
objections or misconduct?
Nice. I think you fixed everything I had pointed out.
On Saturday, 21 February 2015 at 20:46:09 UTC, Kenny wrote:
b) Write DDocs and read documentation. The problem here is that
I'm going to use D only for my own projects and in the last time
I tend to write less documentation, for example I do not write
it
for the most methods of Vector3D.
If
On Wednesday, 25 February 2015 at 20:36:33 UTC, Namespace wrote:
On Wednesday, 25 February 2015 at 20:15:10 UTC, anonymous wrote:
[...]
It may be possible to hack through this limitation - NOT
THOUGHT-OUT, NOT TESTED, NOT RECOMMENDED:
---
void glCheck(scope lazy int thing) @nogc;
On Wednesday, 25 February 2015 at 22:16:14 UTC, Ola Fosheim
Grøstad wrote:
My point was that there is no conceptual difference between
having a named function trusted_malloc!int() and trusted_free()
and wrapping them up individually unnamed.
An ad-hoc declared @trusted malloc is just as
On Tuesday, 24 February 2015 at 22:37:58 UTC, Ola Fosheim Grøstad
wrote:
1. My understanding is that @trusted is supposed to give memory
safety escapes by providing a context which reestablish a
memory safety context on return.
Yep, that's how I got it, too. A @trusted function is supposed to
On Saturday, 24 January 2015 at 13:24:02 UTC, Nordlöw wrote:
This snippet
static immutable words = [ `zero`, `one`, `two` ];
static immutable ubyte[string] wordsAA;
static this()
{
foreach (ubyte i, e; words) { wordsAA[e] = i; }
}
compiles and links on dmd git
On Tuesday, 13 January 2015 at 20:52:15 UTC, Dominikus Dittes
Scherkl wrote:
Of course you can calculate it, but the
syntax looks quite different if you want to do
a.bit[22] = false:
a = ~(116);
Or if you want to test a bit:
if(a.bit[16])
instead of
if(a (116))
much more convenient for
On Friday, 30 January 2015 at 13:11:35 UTC, anonymous wrote:
Lines 846-850:
static if(less == a b)
auto vals = [1, 2, 3, 4, 5];
else
auto vals = [5, 4, 3, 2, 1];
assert(equal(r, vals));
(Tab + Enter strikes again.)
That test looks wrong. So,
On Friday, 30 January 2015 at 12:32:05 UTC, drug wrote:
```
import std.container: RedBlackTree;
class Manager(TT, alias Cmp = ab)
{
alias Container = RedBlackTree!(TT, Cmp);
Container _cont;
static init()
{
auto instance = new typeof(this)();
instance._cont =
On Saturday, 11 April 2015 at 20:10:49 UTC, Dennis Ritchie wrote:
writefln(%(;; %(%s, %),\n%)., [
a[0 .. 15],
a[15 .. 30],
a[30 .. 45],
a[45 .. 60],
a[60 .. 75],
a[75 .. 90],
On Tuesday, 14 April 2015 at 09:24:04 UTC, Filippo Fantini wrote:
Hello everyone!
I'm new to D.
While playing with around with traits,
I ended up writing this short example:
module test;
class Foo
{
private int _value = 21;
void foo()
{
import std.traits;
alias
On Tuesday, 21 April 2015 at 19:17:56 UTC, kevin wrote:
On Tuesday, 21 April 2015 at 19:13:34 UTC, Meta wrote:
On Tuesday, 21 April 2015 at 19:11:43 UTC, John Colvin wrote:
On Tuesday, 21 April 2015 at 19:06:39 UTC, kevin wrote:
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r
On Saturday, 18 April 2015 at 22:01:56 UTC, Ulrich Küttler wrote:
Input ranges from std.stdio are used for reading files. So
assuming we create a file
auto f = File(test.txt, w);
f.writeln(iota(5).map!(a = repeat(to!string(a),
4)).joiner.joiner(\n));
f.close();
We should be able
On Monday, 20 April 2015 at 10:14:27 UTC, Chris wrote:
string a = bla;
string b = blub;
auto res = doSomething(a, b);
If I didn't use auto ref or ref, string would get copied,
wouldn't it?
auto ref doSomething(R needle, R haystack);
To avoid this, I would have to write a[0..$], b[0..$],
On Saturday, 25 April 2015 at 10:23:25 UTC, ref2401 wrote:
struct MyStruct {}
void main(string[] args) {
string str = blah-blah;
auto d1 = (MyStruct) { writeln(delegate-str: , str); };
writeln(typeid(typeof(d1)));
}
dmd: 2067
os: Win8.1
build script: dmd main.d
On Saturday, 25 April 2015 at 14:52:45 UTC, sclytrack wrote:
I want a function with parameter o!(const(Form)) to accept both
o!(Form) and o!(immutable(Form))
Is there a way to do it?
import std.stdio;
import std.traits;
class Form
{
int number = 10;
}
struct o(T)
{
T
On Monday, 20 April 2015 at 17:02:18 UTC, CodeSun wrote:
I have test a snippet of code, and I encountered with a weird
link error.
The following is the demo:
import std.stdio;
interface Ti {
T get(T)(int num);
T get(T)(string str);
}
class Test : Ti {
T get(T)(int num)
On Sunday, 19 April 2015 at 21:42:23 UTC, Ulrich Küttler wrote:
groupBy is a nice example as it laboriously adds reference
semantics to forward ranges but assumes input ranges to posses
reference semantics by themselves.
All ranges are input ranges, though. Input ranges are the least
On Saturday, 2 May 2015 at 22:01:10 UTC, WhatMeWorry wrote:
struct Vertex
{
vec3 position;
vec3 color;
}
Vertex triangle[6] =
[
vec3(0.0, 1.0, 0.0),
vec3(1.0, 0.0, 0.0), // red
// code removed for brevity.
];
I keep getting
On Sunday, 3 May 2015 at 21:46:11 UTC, Robert M. Münch wrote:
Hi, I have now played a around couple of hours (reading
everything I could find) to get something to work, but I think
I'm missing some basic concepts/understanding. Maybe someone
can enlighten me how these things work. I thought
On Monday, 4 May 2015 at 11:22:16 UTC, Robert M. Münch wrote:
Hi, ok, just to better understand this (I have a C++ background
(even quite old)): When I want to use some functions I need to
specify the type? It's not possible to use T.length() which
would compile if T is a string? I thought
On Monday, 4 May 2015 at 11:41:23 UTC, Robert M. Münch wrote:
Hi, I have one more questions: Is it possible to write
something like this?
alias rules = StaticFilter!(startsNotWith(?, 'p'), org_rules);
The ? should be used for every memember of org_rules.
No, we don't have template literals.
On Friday, 1 May 2015 at 21:04:10 UTC, Dennis Ritchie wrote:
hi,
Is it possible to call functions using mixins in this way?
-
import std.stdio;
int fooTestMixin() {
return 5;
}
void main() {
enum t { fooTestMixin };
immutable string[] strArr = [ fooTestMixin ];
On Friday, 1 May 2015 at 21:41:10 UTC, Dennis Ritchie wrote:
My final goal is to do something like this:
-
import std.stdio, std.string;
int foo() {
return 5;
}
int bar() {
return 10;
}
void main()
{
immutable string[] s = [ foo, bar ];
On Friday, 1 May 2015 at 03:34:53 UTC, Luigi wrote:
Hi everybody.
I am tring to use a function where its parameter is another
function, and at the same time are both already made - they
cannot be modified - and the second one has to be conditioned
before to be passed as argument.
Let's say
On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote:
This aside, how would I get something to load dynamically? It's
either mismatched function return type or (with type check)
variable X cannot be read at compile time:
void main(string[] args) {
auto type = args[1];
auto myType =
On Tuesday, 5 May 2015 at 04:09:03 UTC, Manfred Nowak wrote:
class C{
override bool opEquals( Object o){
return true;
}
}
unittest{
auto c= new C;
assert( c == c);
}
`rdmd --main -unittest -cov' shows, that opEquals is not
executed. Why?
-manfred
because `c is c`
On Sunday, 3 May 2015 at 02:31:51 UTC, WhatMeWorry wrote:
On Saturday, 2 May 2015 at 22:36:29 UTC, anonymous wrote:
[...]
[1] `Vertex triangle[6]` works, but please don't do that.
Thanks. I assume you would prefer I use triangle[] but with
OpenGL calls the dynamic arrays don't work. But
On Thursday, 7 May 2015 at 20:55:42 UTC, Nick Sabalausky wrote:
// There's gotta be a better way to convert EnumMembers!T
// to a range, right? But std.range.only() didn't work,
// due to a template instantiation error.
T[] members;
foreach(m; EnumMembers!(T))
members
On Wednesday, 6 May 2015 at 19:52:44 UTC, Paul wrote:
On Wednesday, 6 May 2015 at 19:30:33 UTC, anonymous wrote:
On Wednesday, 6 May 2015 at 19:26:40 UTC, Paul wrote:
but I don't understand the syntax. dmd --help mentions
-Llinkerflag but what is '-L-L.' doing??
Passes '-L.' to the linker.
On Wednesday, 6 May 2015 at 19:26:40 UTC, Paul wrote:
but I don't understand the syntax. dmd --help mentions
-Llinkerflag but what is '-L-L.' doing??
Passes '-L.' to the linker.
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
What does 'shared' do to member variables?
Makes them `shared`. :P
It makes sense to me to put it on a global variable, but what
sense does it make putting it on a member of a class?
Globals are not the only way to pass data to other
On Saturday, 9 May 2015 at 19:59:58 UTC, tcak wrote:
Stupidly, shared variables' value cannot be increased/decreased
directly. Compiler says it is deprecated, and tells me to use
core.atomic.atomicop. You will see this as well.
How's that stupid? Sounds like the compiler is doing its job
On Friday, 8 May 2015 at 22:29:28 UTC, Biotronic wrote:
Sadly, the ... syntax precludes the use of __LINE__ and
__FILE__. :(
You can put them in the runtime parameters:
void traceVars(alias T, U...)(size_t line = __LINE__, string file
= __FILE__) {
import std.stdio : writeln;
On Thursday, 14 May 2015 at 12:42:01 UTC, ivoras wrote:
https://gist.github.com/ivoras/2d7737c214c3dc937c28
The crash is at line 20:
core.exception.AssertError@/usr/include/dmd/phobos/std/container/array.d(334):
[...]
This is on DMD32 D Compiler v2.067.1
Seems to be fixed in git head.
On Sunday, 17 May 2015 at 09:20:17 UTC, Dennis Ritchie wrote:
On Sunday, 17 May 2015 at 09:18:15 UTC, Daniel Kozak wrote:
auto s = cast(char[][])[foo, bar];
Thanks. This version I was completely satisfied.
Remember that Daniel Kozak wrote if you are sure thats what you
really need. I'm
On Thursday, 14 May 2015 at 09:53:20 UTC, Per Nordlöw wrote:
I'm almost satisified with it except that the lazy evaluation at
https://github.com/nordlow/justd/blob/master/algorithm_ex.d#L45
cannot be made nothrow.
If I qualify the function as nothrow DMD complains as
algorithm_ex.d(45,16):
On Saturday, 2 May 2015 at 02:51:52 UTC, Fyodor Ustinov wrote:
Simple code:
http://pastebin.com/raw.php?i=7jVeMFXQ
This code works compiled by DMD v2.066.1 and LDC2 (0.15.1)
based on DMD v2.066.1 and LLVM 3.5.0.
$ ./z
TUQLUE
42
11
Compiled by DMD v2.067.1 the program crashes:
$ ./aa
TUQLUE
On Sunday, 17 May 2015 at 21:34:21 UTC, tcak wrote:
[code]
void test(D)( const D data ) if( is(D: shared(char[]) ) ) { }
void main() {
char[] text = new char[4];
text[0] = 'a'; text[1] = 'b'; text[2] = 'c'; text[3] = 'd';
auto t = cast( shared(const(char[]))
On Monday, 18 May 2015 at 21:35:44 UTC, Per Nordlöw wrote:
void yield(T)(ref T value)
{
mixin(alias caller = ~ caller ~ ;);
}
doesn't work across module boundaries not even for
`__PRETTY_FUNCTION__`.
Do we need need to fix the compiler, Walter?! ;)
You have to import
On Sunday, 17 May 2015 at 09:26:15 UTC, Dennis Ritchie wrote:
And no crashes on Windows :)
Yeah, on windows it's even worse.
void main()
{
auto s = cast(char[][])[foo, bar];
s[1][1] = 't';
import std.stdio;
writeln(bar);
}
On Sunday, 17 May 2015 at 10:09:11 UTC, Daniel Kozak wrote:
On Sunday, 17 May 2015 at 09:25:33 UTC, Namespace wrote:
[...]
Error: e2ir: cannot cast malloc(length * 8u) of type void* to
type char[]
I would say this is not an ICE just normal error message.
e2ir: shouldn't be there, though.
On Thursday, 14 May 2015 at 20:50:05 UTC, ivoras wrote:
I'm experimenting to get a feel for the language. Do you have a
suggestion about this example code: https://goo.gl/F7LCAg to
make it more D-like, idiomatic?
Quoting from the code:
for (int i = 0; i count; i++) {
foreach(i; 0 ..
On Tuesday, 14 April 2015 at 15:20:37 UTC, bitwise wrote:
When I uncomment the nicer syntax, I get the errors below:
[1] Error: variable refl cannot be read at compile time
[2] Error: CTFE failed because of previous errors in base
class Base {
double d = 0.4;
}
class Test : Base {
On Wednesday, 8 April 2015 at 12:05:00 UTC, ddos wrote:
vg.d:
module vg;
extern (C) void vgSetParameterfv(VGHandle object, VGint
paramType, VGint count, VGfloat *values);
openvg.d
module openvg;
public import vg;
void vgSetParameterfv(VGHandle object, VGint paramType,
const(VGfloat[])
On Wednesday, 1 April 2015 at 18:26:49 UTC, Charles Hixson wrote:
Perhaps BTree needs to be a class?
yes
On Wednesday, 8 April 2015 at 22:53:39 UTC, ddos wrote:
why not just make it callable without the alias?
It's to prevent hijacking: http://dlang.org/hijack.html
On Monday, 18 May 2015 at 14:34:38 UTC, ketmar wrote:
it can throw out of range error, which is `new`ed.
Array access can also throw RangeError, but -vgc and @nogc don't
mind that:
void main() @nogc
{
int[] a;
auto b = a[0];
}
On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:
I am getting an core.exception.InvalidMemoryOperationError@(0)
auto recs = f // Open for reading
.byLineCopy();
.array; //Here is where is appears
to be happening.
I have
On Monday, 22 June 2015 at 18:44:22 UTC, Assembly wrote:
I'm using this, thanks for all. Can someone clarify how does
opApply() works? I assume it's called every iteration and as
opApply() has a loop does it means the number of iteration ran
actually is the ones from foreach() is 2*n where n
On Tuesday, 23 June 2015 at 07:57:26 UTC, Charles Hawkins wrote:
Sigh. I'm probably doing something stupid. I tried full paths:
dmd -I+/home/charles/projects/d/mylib/source/mylib/ myprog.d
What's that plus sign doing there? Looks wrong.
/home/charles/projects/d/mylib/build/libmylib.a
Same
On Wednesday, 10 June 2015 at 17:00:34 UTC, Dennis Ritchie wrote:
Isnt it possible to come up with the interpreter compile-time,
which will determine the operating time of the program at
runtime at compile time.
Sounds like the halting problem. So, no, generally this is not
possible.
On Thursday, 11 June 2015 at 19:56:00 UTC, kerdemdemir wrote:
Can I achieve something faster than code below?
auto peopleMoney = stdin.readln().split().map!(a =
to!int(a)).array();
if (peopleMoney.length == 20)
writeln(:();
`std.array.split` is eager. It may be faster if you
On Monday, 15 June 2015 at 15:10:24 UTC, jmh530 wrote:
float[] exp(float[] x) {
auto y = x.map!(a = exp(a));
cast(float[]) y;
return y;
}
But I get an error that I can't convert MapResult!(__lambda2,
float[]) to float[].
So I suppose I have two questions: 1) am I
On Tuesday, 16 June 2015 at 21:17:37 UTC, tcak wrote:
As far as I known, when I define a string with enum and it is
used at different parts of code, that string is repeated again
and again in executable file instead of passing a pointer to
string. So, using enum with string doesn't seem like a
On Sunday, 14 June 2015 at 10:10:51 UTC, ketmar wrote:
i.e. when it need a value in compile time. the interpreter is
invoked, it evaluates (interprets) the given code (function or
template instantiation), and then it returns result (or raises
an error).
One important thing I didn't see
On Sunday, 14 June 2015 at 10:41:24 UTC, JDemler wrote:
So if i want to use parameters in a static context at compile
time i have to pass them as template parameters?
Yes, template parameters are fine.
To come back to destructors and immutable objects:
Even without the default initialized variables issue it is
possible to modify immutable data:
struct S {
int[] bar;
~this() {
bar[0] = 123;
}
}
void foo(immutable(int[]) i) {
immutable(S) s = immutable S(i);
}
void main() {
On Saturday, 13 June 2015 at 00:47:37 UTC, Mike Parker wrote:
// config.d
version(One) enum One = true;
else enum One = false;
version(Two) enum Two = true;
else enum Two = false;
// other.d
import config;
static if(One || Two) {
...
}
Taking it one step further:
template Version(string
On Saturday, 13 June 2015 at 15:21:19 UTC, Dennis Ritchie wrote:
Hello, everyone!
I like to work with arrays of strings like `string[] strArray`,
but unfortunately, they are immutable.
I do not like to work with arrays of strings such as `char[][]
strArray`, because it is necessary to apply
On Saturday, 13 June 2015 at 17:02:06 UTC, Dennis Ritchie wrote:
On Saturday, 13 June 2015 at 16:20:46 UTC, anonymous wrote:
[...]
Yeah, that would be neat. But typing out .dup isn't that
bad, and converting a `string[]` to a `char[][]` is simple:
import std.conv: to;
auto a =
On Saturday, 13 June 2015 at 15:58:44 UTC, Dennis Ritchie wrote:
On Saturday, 13 June 2015 at 15:45:34 UTC, anonymous wrote:
Before jumping to a solution, please elaborate on the
perceived problem. I have a feeling that there is none.
Do you like to write?
char[][] strArray = [foo.dup,
On Saturday, 13 June 2015 at 16:09:58 UTC, Dennis Ritchie wrote:
On Saturday, 13 June 2015 at 15:45:34 UTC, anonymous wrote:
[...]
Are you saying that `string[]` is simpler than `char[][]`?
That's not true: `string` is an alias for `immutable(char)[]`,
so `string[]` is the same as
Is there an existing issue on issue.dlang.org? If not can you
report it
https://issues.dlang.org/show_bug.cgi?id=10376
no need for ~this() to modify immutable data:
class C {
int a;
this(int a) {
this.a = a;
}
}
struct S {
C elem = new C(42);
}
void main() {
import std.stdio;
immutable(S) s1;
// Error: cannot modify immutable expression
I cannot find a way to actually modify immutable memory with
it...
a.d:
class C {
int a;
this(int a) {
this.a = a;
}
}
struct S {
int x;
C elem = new C(42);
~this() {
import std.stdio;
writeln(mutable ~this());
x = 1;
elem.a = 123;
On Wednesday, 1 July 2015 at 20:01:08 UTC, dd0s wrote:
i have the following struct, and i expect it to have 30 bytes
but sizeof tells me it has 32 bytes. dmd seems to still use
4byte alignment altough i specified to align 2bytes.
struct netadr_t {
align(2):
inttype; // 0
On Wednesday, 1 July 2015 at 17:13:03 UTC, Taylor Hillegeist
wrote:
string q = cast(string)
(A.cycle.take(seg1len).array
~B.cycle.take(seg2len).array
~C.cycle.take(seg3len).array);
q.writeln;
I was wondering if it might be the cast?
Yes, the cast is wrong. You're reinterpreting (not
On Sunday, 28 June 2015 at 16:28:20 UTC, jmh530 wrote:
Thanks for the reply. Two follow ups: 1) Does labeling a
template as pure matter if the compiler infers it anyway? 2)
Does the compiler also infer anything for @safe/nothrow in
templates?
1) It means you can't instantiate the template
On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote:
Just creating a bunch (10k) of sleeping (for 100 msecs)
goroutines/tasks.
Compilers
go: go version go1.4.2 linux/amd64
vibe.d: DMD64 D Compiler v2.067.1 linux/amd64, vibe.d 0.7.23
Code
go: http://pastebin.com/2zBnGBpt
On Sunday, 28 June 2015 at 09:19:16 UTC, Tofu Ninja wrote:
module main;
import std.stdio;
void main(string[] args)
{
auto d = foo();
writeln(d()); // prints 25
}
auto foo()
{
int x = 4;
pure int delegate() d = delegate()
{
return x*x;
On Sunday, 28 June 2015 at 01:57:46 UTC, xky wrote:
hello. :-)
when i was using DerelictSFML2(
http://code.dlang.org/packages/derelict-sfml2 ), i got this
problem.
CSFML doc had 'setUnicodeString':
On Monday, 6 July 2015 at 07:48:17 UTC, sigod wrote:
Aren't compiler smart enough to prevent it?
```
ubyte[] test1()
{
auto b = sha1Of();
return b; // Error: escaping reference to local b
}
ubyte[] test2()
{
return sha1Of(); // works, but returns incorrect data
}
```
On Monday, 6 July 2015 at 01:16:54 UTC, Peter wrote:
Hi,
I have a struct with arithmetic operations defined using
opBinary but array operations with arrays of it don't work.
struct Vector3 {
public double[3] _p;
...
Vector3 opBinary(string op)(in Vector3 rhs) const
if (op ==
On Monday, 6 July 2015 at 03:02:59 UTC, Nicholas Wilson wrote:
On Monday, 6 July 2015 at 01:16:54 UTC, Peter wrote:
[...]
unittest{
auto a = Vector3([2.0, 2.0, 0.0]);
auto b = Vector3([1.0, 2.0, 1.0]);
Vector3[] c = [a];
Vector3[] d = [b];
Vector3 e = a + b; // works
On Thursday, 2 July 2015 at 17:33:29 UTC, Laeeth Isharc wrote:
Any thoughts on what could be leading to the following:
./../../marketdata/source/pricebar.d(397): Error: incompatible
types for ((bar.high) + (bar.low)): 'FixedDecimal!(int, 8)' and
'FixedDecimal!(int, 8)'
On Monday, 6 July 2015 at 12:15:22 UTC, Peter wrote:
dmd 2.066.1, windows 7 64bit
Tested it on Windows 7, using dmd 2.066.1: works for me.
The exact code I tested (just commented those ... out):
struct Vector3 {
public double[3] _p;
//...
Vector3 opBinary(string op)(in
On Monday, 6 July 2015 at 20:50:19 UTC, Gary Willoughby wrote:
How do you correctly implement a bidirectional range on a
linked list?
I have a linked list implementation and I've added a range
interface to it but after a while I've realized it not quite
right. The problem is when I call the
On Monday, 6 July 2015 at 21:58:31 UTC, anonymous wrote:
To make your removal methods stable, it may be enough to not
free the removed node. That is, don't do this:
https://github.com/nomad-software/etcetera/blob/master/source/etcetera/collection
Looks like I messed up the URL. Here's the
On Monday, 29 June 2015 at 12:04:46 UTC, Jonathan M Davis wrote:
You haven't declared an immutable constructor, so you can't
construct an immutable Foo.
That's not what's happening. Constructing an immutable Foo works
just fine.
On Monday, 29 June 2015 at 22:11:16 UTC, sigod wrote:
`new immutable(MyClass)()` is invalid code.
It's perfectly fine, actually.
On Thursday, 2 July 2015 at 19:03:49 UTC, dd0s wrote:
i got a date t described in seconds from 1.1.1970,
I.e., you have a unix timestamp.
and i want to check if the current time is further than 12
hours from the given time t. the following code works but it's
super ugly =S
please give me
On Sunday, 24 May 2015 at 17:35:39 UTC, Jay Norwood wrote:
I'm a bit confused by the documentation of the ctfe limitations
wrt static arrays due to these seemingly conflicting
statements, and the examples didn't seem to clear anything up.
I was wondering if anyone has examples of clever
On Sunday, 24 May 2015 at 18:14:19 UTC, anonymous wrote:
Static array has a special meaning. It does not mean static
variable with an array type. Static arrays are those of the
form Type[size]. That is, the size is known statically.
PS: You may also see the term fixed-size array which means
On Sunday, 24 May 2015 at 20:53:03 UTC, Jay Norwood wrote:
On Sunday, 24 May 2015 at 18:14:19 UTC, anonymous wrote:
[...]
1) static int[5] x; -- x is a static variable with a static
array type
2) static int[] x; -- static variable, dynamic array
3) int[5] x; -- non-static variable, static
On Monday, 25 May 2015 at 17:52:09 UTC, Dennis Ritchie wrote:
But why is the solution breaks down when `s = 1` ? :)
import std.stdio, std.algorithm, std.range;
int c;
const x = 12, y = 65, z = 50, s = 10;
Which is it, now? 4 or 5 zeros?
void solve(Range)(Range r) {
201 - 300 of 560 matches
Mail list logo