On 01/31/2012 06:15 PM, Nicolas Silva wrote:
Hi,
Works for me. Which version of the compiler are you using?
Sorry, i forgot to mention: i'm using dmd 2.057 on ubuntu 32bit.
I am using DMD 2.057 on Ubuntu 64bit. Are you sure that it does not
work? Can anyone reproduce the error?
import
On 01/28/2012 04:56 PM, sclytrack wrote:
On 01/25/2012 01:12 AM, Timon Gehr wrote:
On 01/24/2012 10:28 PM, %u wrote:
Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
Issue 7391 - floating wtf dmd 2.057 64
Thanks!
On 01/26/2012 08:44 PM, Jacob Carlborg wrote:
On 2012-01-26 10:29, Jacob Carlborg wrote:
I'm trying to port a simple example that uses Clang from C to D but for
some reason the D version results in a segmentation fault.
This is the C code:
http://pastebin.com/4B2JGz9n
This is the D code:
On 01/25/2012 12:28 PM, C wrote:
auto chunk = new ubyte[1024];
foreach(ref x; chunk) x = uniform![](ubyte.min, ubyte.max);
Thank you all for your replies.
@ Timon, I have two questions:
1) How come you can omit parentheses for uniform's parameter, shouldn't it be
uniform!([])(...) ?
If
On 01/25/2012 04:50 AM, bearophile wrote:
C:
I want to fill a ubyte array with random data.
In D ubytes are not char, they are two different types. So if you want ubytes,
then use ubytes:
uniform!([])(ubyte.min, ubyte.max)
Regarding your error, a reduced test case:
import std.random:
On 01/25/2012 04:25 AM, C wrote:
I want to fill a ubyte array with random data.
The code compiles with no warnings or errors.
Source snippet:
auto prng = Random(unpredictableSeed);
ubyte[] chunk;
chunk.length = 1024;
fill(chunk, uniform!([])('\x00',
On 01/25/2012 02:29 AM, H. S. Teoh wrote:
On Tue, Jan 24, 2012 at 08:01:41PM -0500, bearophile wrote:
Jonathan M Davis:
Now, the confusing part is the fact that unlike C++, D allows you to put the
const for making the function on the _left-hand_ side of the function (C++
only lets you put it
On 01/26/2012 12:35 AM, H. S. Teoh wrote:
On Wed, Jan 25, 2012 at 11:50:57PM +0100, Timon Gehr wrote:
On 01/25/2012 02:29 AM, H. S. Teoh wrote:
[...]
But since Walter doesn't like the idea of restricting the syntax to 'int
y() const', then what about making it mandatory to write
On 01/24/2012 07:51 PM, xancorreu wrote:
Al 24/01/12 13:37, En/na Dejan Lekic ha escrit:
Xan, read this article please:
http://www.informit.com/articles/article.aspx?p=1609144
You have exactly what you are looking for in the D runtime and
standard library.
I read it and **after** I post the
On 01/24/2012 10:28 PM, %u wrote:
Shouldn't this go into 'digitalmars.D' ?
It should go straight to the bug tracker.
On 01/23/2012 07:06 PM, bearophile wrote:
Ellery Newcomer:
void main(){
for ({int x=0; short y=0;} x 10; x++, y++){
}
}
I don't understand, is that a compiler bug?
Aren't x and y in a sub-scope that ends before you use x and y?
Bye,
bearophile
It is not a bug.
On 01/23/2012 08:01 PM, Xan xan wrote:
Hi.
Is there any actors library in D. Spawn and etc is ok, but I want more
high-level thing and actors it's the best I get, I think.
I searched and nothing.
I'm interested in D 2.0 or 1.0. Whatever!
Thanks in advace,
Xan.
std.concurrency is an actors
On 01/23/2012 12:51 AM, Caligo wrote:
struct A(uint samples){
float[samples] _data = void;
this(float val = 0.0f){ fill(_data[], val); }
}
auto a = A!8();
a._data is filled with garbage instead of zeros because the
no-argument constructor is called instead of the one that I've
On 01/20/2012 03:12 PM, Mars wrote:
Hello everybody.
As the title states, I want to run a function in a new thread, and pass
it some arguments. How would I do that? I guess I could make a class,
deriving from Thread, and work with it, but out of curiosity, I'd like
to know if it's possible with
On 01/19/2012 09:30 PM, Era Scarecrow wrote:
Been a bit out of it for a while, but finding enough tools at my disposal I
feel I can work on/convert a project now.
I happen to have one of the first printing books (without the name on the
cover), and although it may be worth millions in a
On 01/19/2012 05:41 PM, Jerome BENOIT wrote:
Hello List:
On my box, the following D source, inspired by the subsection 5.6.1 of
tDpl,
does not work as expected:
-
// adhoc_06.d
import std.stdio;
unittest {
// Tersest, most
On 01/19/2012 04:30 PM, Xan xan wrote:
Hi,
I want to simply code a script to get the url as string in D 2.0.
I have this code:
//D 2.0
//gdmd-4.6
import std.stdio, std.string, std.conv, std.stream;
import std.socket, std.socketstream;
int main(string [] args)
{
if (args.length 2) {
On 01/19/2012 10:55 PM, RenatoL wrote:
Just curious: why in D we are not obligated to use break in every
branch of a swicth structure? That is:
switch (i)
{
case 1:
writeln(You wrote 1);
case 2:
writeln(You wrote 2);
On 01/18/2012 04:40 AM, H. S. Teoh wrote:
So, I was quite impressed with D's pureness system, and was
experimenting a bit with it. Then I discovered that delegates are
impure, which seems reasonable since there's no way to know what a
delegate might do. But *if* the compiler verifies that a
On 01/18/2012 02:32 PM, Jerome BENOIT wrote:
On 18/01/12 04:36, Jonathan M Davis wrote:
On Wednesday, January 18, 2012 02:33:25 Jerome BENOIT wrote:
And I cannot figure why :-(
http://d.puremagic.com/issues/show_bug.cgi?id=1528
As a workaround, templatize the last function by changing its
On 01/18/2012 04:57 PM, Timon Gehr wrote:
On 01/18/2012 02:32 PM, Jerome BENOIT wrote:
On 18/01/12 04:36, Jonathan M Davis wrote:
On Wednesday, January 18, 2012 02:33:25 Jerome BENOIT wrote:
And I cannot figure why :-(
http://d.puremagic.com/issues/show_bug.cgi?id=1528
As a workaround
On 01/18/2012 05:40 PM, Jerome BENOIT wrote:
On 18/01/12 17:07, Timon Gehr wrote:
On 01/18/2012 04:57 PM, Timon Gehr wrote:
On 01/18/2012 02:32 PM, Jerome BENOIT wrote:
On 18/01/12 04:36, Jonathan M Davis wrote:
On Wednesday, January 18, 2012 02:33:25 Jerome BENOIT wrote:
And I cannot
On 01/17/2012 06:02 PM, Matej Nanut wrote:
On 17 January 2012 16:54, H. S. Teohhst...@quickfur.ath.cx wrote:
This may be the cause of your trouble. If the nested class references
members in the outer class, then moving it outside will break it, since
it won't have an outer scope anymore.
T
On 01/17/2012 05:02 PM, Don Clugston wrote:
On 15/01/12 20:35, Timon Gehr wrote:
On 01/14/2012 07:13 PM, Vladimir Matveev wrote:
Hi,
Is there a reason why I cannot compile the following code:
module test;
struct Test {
int delegate(int) f;
}
Test s = Test((int x) { return x + 1; });
void
On 01/17/2012 07:13 PM, Matej Nanut wrote:
On 17 January 2012 19:07, H. S. Teohhst...@quickfur.ath.cx wrote:
Andrei's book (The D Programming Language) is quite thorough in
explaining these D constructs. It's a highly recommended buy if you're
doing serious work in D.
T
--
The two rules of
On 01/17/2012 06:58 PM, Matej Nanut wrote:
On 17 January 2012 18:29, Timon Gehrtimon.g...@gmx.ch wrote:
I'm quite sure that the error in your code occurs for the same reason as in
the following code snippet:
class C{
class D{}
static make(){return new D();} // error
}
You can fix it
On 01/17/2012 08:21 PM, H. S. Teoh wrote:
On Tue, Jan 17, 2012 at 09:07:05AM -0800, Jonathan M Davis wrote:
[...]
Exception itself isn't @safe yet (its constructor in particular), and
I don't think that AssertError is either. A number of stuff like that
in druntime and Phobos still needs to be
On 01/17/2012 11:31 PM, Jonathan M Davis wrote:
On Tuesday, January 17, 2012 14:14:36 H. S. Teoh wrote:
On Tue, Jan 17, 2012 at 05:04:18PM -0500, Jonathan M Davis wrote:
[...]
Attribute inferrence is a big step forward in making as much as
possible @safe and pure, but there's still plenty to
On 01/18/2012 01:35 AM, bearophile wrote:
Is code vaguely like this meaningful and useful?
void main() {
alias (x = x ^^ 2) sqrTemplate;
}
Bye,
bearophile
Yes. The fact that your particular example does not work is a mere
syntactic issue.
This works:
template ID(alias a){alias a
On 01/16/2012 09:40 PM, H. S. Teoh wrote:
On Mon, Jan 16, 2012 at 09:32:57PM +0100, Alex Rønne Petersen wrote:
[...]
I... don't think the error messages from expanding raw object code
would be very pleasant to read, if you used a template incorrectly...
[...]
It doesn't have to be
On 01/17/2012 12:49 AM, Matej Nanut wrote:
Hey everyone,
I, once again, have a problem with an error I can't seem to figure out!
The situation:
- a class, inherited by five other classes;
- the class having a static function which returns one
if its subclasses depending on the input of a
On 01/15/2012 02:38 AM, bearophile wrote:
If I have a simple fixed-size matrix and I need to linearize (flatten) it, the
function join() seems to not not work:
import std.array: join;
void main() {
int[4][4] table;
join(table);
}
test.d(4): Error: template std.array.join(RoR,R) if
On 01/14/2012 07:13 PM, Vladimir Matveev wrote:
Hi,
Is there a reason why I cannot compile the following code:
module test;
struct Test {
int delegate(int) f;
}
Test s = Test((int x) { return x + 1; });
void main(string[] args) {
return;
}
dmd 2.057 says:
test.d(7): Error:
On 01/15/2012 10:02 PM, Nick Sabalausky wrote:
Timon Gehrtimon.g...@gmx.ch wrote in message
news:jevefv$2je6$1...@digitalmars.com...
On 01/15/2012 09:34 PM, Nick Sabalausky wrote:
import std.conv;
enum Foo { hello }
enum x = to!string();
enum x = to!string(Foo.hello);
Goddamnnit, what
On 01/13/2012 10:34 PM, Jorge wrote:
Thanks for your answer but:
import std.stdio;
import std.conv;
void main()
{
write(Insert number: );
string s = readln();
auto i = to!int(s);
}
compiles but after i enter a number and press the enter key i get:
On 01/13/2012 02:19 AM, bearophile wrote:
This code compiles, because the [0,0] dynamic array literal casts implicitly to
int[2]:
int[2] foo() {
return [0, 0]; // OK
}
void main() {}
And of course this too compiles:
int[2] bar() {
int[2] ab;
return (true) ? ab : ab; // OK
}
On 01/13/2012 05:07 AM, Charles McAnany (dlang) wrote:
Hi, all. So I'm trying to make some very ugly code generic. The main
ugliness isn't in the code shape, it's in the running time. It's O(n^m)
Eww! (don't worry, n is only about 6.)
Anyhoo, Here's what I want:
void foo(int size)(int[]
On 01/07/2012 12:37 AM, Jonathan M Davis wrote:
On Saturday, January 07, 2012 00:03:39 Alex Rønne Petersen wrote:
Most likely those functions are just implemented using inline assembly,
therefore not usable in CTFE.
Yeah, several functions in std.math use inline assembly. So, for them to be
On 01/05/2012 07:14 PM, Joshua Reusch wrote:
Am 05.01.2012 17:21, schrieb Puming Zhao:
Hi, I'm new in D programming, and does not have much C experience
either. After
reading TDPL book and playing with some sample codes, I came to decide
to try
something more `practical`. I began with a Redis
On 01/04/2012 11:19 PM, Caligo wrote:
I have a function that looks something like this:
bool fun(double theta, out A a, out B b, out C c){ /* ... */ }
if fun() returns false, then nothing is supposed to be assigned to a,
b, c. If it returns true, then values are assigned to a, b, c. Also,
On 01/03/2012 12:07 PM, Jonathan M Davis wrote:
On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote:
Hello everyone,
I would like to know whether
if (symbol in symbols)
return symbols[symbol];
is any less efficient than
auto tmp = symbol in symbols;
On 01/03/2012 12:22 PM, Jonathan M Davis wrote:
On Tuesday, January 03, 2012 12:13:45 Timon Gehr wrote:
On 01/03/2012 12:07 PM, Jonathan M Davis wrote:
On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote:
Hello everyone,
I would like to know whether
if (symbol in symbols
On 01/04/2012 12:31 AM, Jonathan M Davis wrote:
On Tuesday, January 03, 2012 17:41:12 simendsjo wrote:
I guess this is as designed, but I'll ask anyway.
http://dlang.org/operatoroverloading.html#Cast says an expression is
rewritten to opCast whenever a bool result is expected.
This is true
On 01/03/2012 05:41 PM, simendsjo wrote:
I guess this is as designed, but I'll ask anyway.
http://dlang.org/operatoroverloading.html#Cast says an expression is
rewritten to opCast whenever a bool result is expected.
This is true for
if(e) somethingElse
and e somethingElse
, but not for other
On 01/02/2012 03:02 PM, Joshua Reusch wrote:
Is it possible to create a template turning any value into a lvalue?
This would be helpful if a function expects a reference but you dont
need the result of the change:
///decode(S)(in S str, ref size_t index);
auto c = std.utf.decode(some_string,
On 01/02/2012 11:04 PM, RenatoL wrote:
auto r = new int[][5];
this is ok
auto r = new int[][];
this is not ok
Error: new can only create structs, dynamic arrays or class objects
, not int[][]'s
why?
What would you expect the code to do?
What you are trying to achieve is similar to:
class
On 01/02/2012 11:21 PM, RenatoL wrote:
Just curious... the answer of the compiler it's a bit unclear to
me...
T[] is a dynamic array of type T.
T[][] is a dynamic array of T[]. But this doesn't work. Why?
It does work. Why do you think it does not?
T[] a; // ok
T[][] b;
On 01/03/2012 12:03 AM, RenatoL wrote:
I have:
auto r = new int[][];
Error: new can only create structs, dynamic arrays or class objects
, not int[][]'s
while
auto r = new int[][3];
is ok.
new int[][3] is an alternate form of new int[][](3); new int[][3]
allocates an int[][] with 3
On 01/03/2012 12:02 AM, Mafi wrote:
Am 02.01.2012 23:33, schrieb Timon Gehr:
On 01/02/2012 11:21 PM, RenatoL wrote:
Just curious... the answer of the compiler it's a bit unclear to
me...
T[] is a dynamic array of type T.
T[][] is a dynamic array of T[]. But this doesn't work. Why?
It does
On 01/03/2012 12:46 AM, Matej Nanut wrote:
On 3 January 2012 00:27, Timon Gehr timon.g...@gmx.ch
mailto:timon.g...@gmx.ch wrote:
On 01/03/2012 12:03 AM, RenatoL wrote:
I have:
auto r = new int[][];
Error: new can only create structs, dynamic arrays or class
On 12/28/2011 02:29 PM, bearophile wrote:
One thing that I often find not handy in the design of do-while loops: the scope of their
body ends before the while:
void main() {
do {
int x = 5;
} while (x != 5); // Error: undefined identifier x
}
So I can't define inside them
On 12/28/2011 04:01 PM, Andrej Mitrovic wrote:
A very small cheat:
void main()
{
if (int x = 0)
do {
x = 5;
} while (x != 5);
}
Only works for this simple case though. Put your post in d.general, I
totally agree with it as well.
This won't work. The 'if' condition is
On 12/28/2011 06:42 PM, bearophile wrote:
Timon Gehr:
I fully agree, but why does this go to D.learn?
Because I think there's no hope to see this situation changed :-)
Bye,
bearophile
Why? The only D code that would get broken would be code that uses a
global variable in the loop
On 12/28/2011 09:32 PM, Alex Rønne Petersen wrote:
On 28-12-2011 18:50, Timon Gehr wrote:
On 12/28/2011 06:42 PM, bearophile wrote:
Timon Gehr:
I fully agree, but why does this go to D.learn?
Because I think there's no hope to see this situation changed :-)
Bye,
bearophile
Why? The only
On 12/28/2011 10:45 PM, Manfred Nowak wrote:
bearophile wrote:
void main() {
do {
int x = 5;
} while (x != 5); // Error: undefined identifier x
}
Do you mean, that the similar while-loop should also be okay?
| void main() {
| while (x != 5) /* uses `x' out of
On 12/24/2011 02:02 AM, Jonathan M Davis wrote:
The core problem for a number of these situations is how types are handled
with regards to expressions. In an expression such as
char[] arr = s ~ '.';
the type of the value being assigned is determined _before_ the assignment is
done. So, even
On 12/24/2011 07:00 PM, Andrew Wiley wrote:
On Sat, Dec 24, 2011 at 9:50 AM, Timon Gehrtimon.g...@gmx.ch wrote:
On 12/24/2011 06:18 PM, Andrew Wiley wrote:
2011/12/24 Mr. Anonymousmailnew4s...@gmail.com:
On 24.12.2011 19:01, Denis Shelomovskij wrote:
23.12.2011 22:51, bearophile пишет:
On 12/24/2011 08:41 PM, Mr. Anonymous wrote:
On 24.12.2011 21:22, Andrew Wiley wrote:
On Sat, Dec 24, 2011 at 1:08 PM, Timon Gehrtimon.g...@gmx.ch wrote:
On 12/24/2011 07:00 PM, Andrew Wiley wrote:
On Sat, Dec 24, 2011 at 9:50 AM, Timon Gehrtimon.g...@gmx.ch wrote:
On 12/24/2011 06:18 PM,
On 12/24/2011 08:22 PM, Andrew Wiley wrote:
On Sat, Dec 24, 2011 at 1:08 PM, Timon Gehrtimon.g...@gmx.ch wrote:
On 12/24/2011 07:00 PM, Andrew Wiley wrote:
On Sat, Dec 24, 2011 at 9:50 AM, Timon Gehrtimon.g...@gmx.chwrote:
On 12/24/2011 06:18 PM, Andrew Wiley wrote:
2011/12/24 Mr.
On 12/24/2011 11:23 AM, André Stein wrote:
Hi,
I'm trying to write a template function which takes a templated alias to
another type:
struct test(T)
{
}
template aliasT(T)
{
alias test!(T) aliasT;
}
void foo(T)(test!T t) { // works
}
void foo2(T)(aliasT!T t) { // doesn't work
}
int
On 12/21/2011 09:15 PM, Elvis Maehren wrote:
This works fine at runtime, but explodes in CTFE:
---
bool isInstanceOf(T, O)(O o) {
return (cast(T) o) !is null;
}
---
CTFE doesn't like !is null (cannot compare [...] at compile time).
This will be fixed in the next release:
On 12/22/2011 10:28 AM, Jacob Carlborg wrote:
On 2011-12-22 08:47, Johannes Pfau wrote:
Hi,
the following code is reduced from a parser generated with Ragel
(http://www.complang.org/ragel/). That's also the reason why it's
using pointers instead of array access, but Ragel guarantees that there
On 12/21/2011 04:54 PM, pompei2 wrote:
Hello.
I want to add the option to iterate objects of my class using foreach. I
need them to be iterable as view-only const and as mutable too. I would
prefer to iterate using the return a delegate but if that's not
possible, ranges are fine too. Also, I'd
On 12/20/2011 02:32 PM, Michal Minich wrote:
My naive approach doesn't works
struct Item1 (T) {}
struct Item2 (T) {}
struct Group (Items ...)
{
// how to do this? ... no static foreach :(
static foreach (I; Items)
mixin I!(int);
}
void main ()
{
alias Group!(Item1,
On 12/20/2011 03:18 PM, clk wrote:
Thank you for your quick replies. I'm impressed by the helpfulness and
dedication of the D community!
Here's another one. Is there a way to pass arguments to functions by
keyword as in the calls to f and g below?
void f(int a = 0, int b = 1) {}
void g(int a)
On 12/19/2011 01:04 PM, Bear wrote:
Using D1, I have a program that creates tons of float[] ; for performance
reasons, I would like them to be uninitialized.
I've tried replacing
float[] f = new float[x];
by
float[] f = cast(float[])std.gc.malloc(x*4);
Unfortunately I keep running into Access
On 12/20/2011 07:12 PM, bearophile wrote:
Stewart Gordon:
On 19/12/2011 12:12, bearophile wrote:
Try something like this (untested):
alias float TF;
TF[] f = (cast(TF*)std.gc.malloc(x * TF.sizeof))[0 .. x];
snip
I fail to see any real difference from the OP's code:
- Why the alias?
On 12/20/2011 07:13 PM, bearophile wrote:
Michal Minich:
struct Group (Items ...)
{
// how to do this? ... no static foreach :(
static foreach (I; Items)
In D if you use foreach on a typeTuple you get a static foreach.
Bye,
bearophile
Yes, but foreach cannot be used in
On 12/19/2011 06:46 PM, Philippe Sigaud wrote:
On Mon, Dec 19, 2011 at 15:35, Heromythbitwo...@qq.com wrote:
Woo, I got it.
What's the difference with your first post?
He uses an eponymous template now.
On 12/19/2011 09:30 PM, Philippe Sigaud wrote:
On Mon, Dec 19, 2011 at 18:49, Timon Gehrtimon.g...@gmx.ch wrote:
On 12/19/2011 06:46 PM, Philippe Sigaud wrote:
On Mon, Dec 19, 2011 at 15:35, Heromythbitwo...@qq.comwrote:
Woo, I got it.
What's the difference with your first post?
On 12/18/2011 11:12 PM, RenatoL wrote:
Reading the book from Alexandrescu we can find this (page 103-104,
at least in my edition):
Expanding arrays has a couple of subtleties that concern possible
reallocation of the array. Consider:
auto a = [87, 40, 10, 2];
auto b = a; // Now a and b refer
On 12/17/2011 02:43 AM, bearophile wrote:
A small quiz. This Python2 code:
m1 = [[A', B']]
print m1
m2 = m1 + [[]]
print m2
Prints:
[[A', B']]
[[A', B'], []]
What does this D2 program print?
import std.stdio;
void main() {
string[][] m1 = [[A', B']];
writeln(m1);
string[][]
On 12/16/2011 06:12 PM, dune wrote:
What?
Sorry but I don't understand...
What I posted was an example, in reality there is tons of code inside the d
file.
Thanks
That is not what you said. Obviously you should always give an example
that actually fails, especially when you claim it does.
On 12/15/2011 06:04 PM, Jonathan M Davis wrote:
On Thursday, December 15, 2011 13:57:21 deadalnix wrote:
Even haskell has non pure functions (IO monad for exemple).
Actually, Haskell is a 100% purely functional language.
Not entirely. For example:
On 12/14/2011 01:28 PM, Kagamin wrote:
Goal would be to have a possibility to compile and let run code from
random people (some of them perhaps evil minded), watch over the
processes and kill them, if they take too long or use up too much memory.
I believe this is what SafeD is for.
SafeD
On 12/14/2011 09:14 PM, Justin Whear wrote:
I've looked through std.algorithm and std.range, but haven't found anything
to compute the Cartesian product of several ranges. I have the nagging
feeling that this can be accomplished by combining several of the range
transformations in the standard
On 12/12/2011 03:35 PM, ParticlePeter wrote:
Hi,
I have a hard time reading in a string from a file. I don't get any compile
time or run time errors, but my application does not work reliably when I read
a string from a file. But when I define the same string within my code,
everything runs
On 12/12/2011 06:37 PM, bearophile wrote:
Timon Gehr:
string fragString = readText( Shader.vert ) ~ '\0';
I think using toStringz is more self-documenting.
Bye,
bearophile
There is nothing more self-documenting than actually appending the zero.
Claiming toStringz is better in that regard
On 12/09/2011 09:32 PM, Ali Çehreli wrote:
On 12/08/2011 12:52 PM, Timon Gehr wrote:
On 12/08/2011 09:50 PM, RenatoL wrote:
snippet 1)
auto arr1 = [1,2,3];
auto arr2 = arr1;
arr1[1] = 22;
arr2[2] = 33;
foreach (i; 0..arr1.length) write(arr1[i], );
writeln();
foreach (i; 0
On 12/08/2011 09:50 PM, RenatoL wrote:
snippet 1)
auto arr1 = [1,2,3];
auto arr2 = arr1;
arr1[1] = 22;
arr2[2] = 33;
foreach (i; 0..arr1.length) write(arr1[i], );
writeln();
foreach (i; 0..arr2.length) write(arr2[i], );
output:
1 22 33
1
On 12/04/2011 12:00 PM, Kagamin wrote:
Dejan Lekic Wrote:
Do D2 aggregates behave the same, or are there notable differences?
D restricts usage to static initializers only, C++ doesn't have this limitation.
This works:
struct S{int x;}
void main(){
int a;
S x = {a};
}
What does
On 12/04/2011 03:01 PM, GrahamC wrote:
Is there a good reason why align() applied to structure definitions is not
allowed on the struct definition line within unit-test code blocks?
E.g.:
unittest {
align(1) struct Foo {
char c;
int i;
}
On 12/03/2011 09:49 PM, Jonathan M Davis wrote:
On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote:
On 12/3/11, Jonathan M Davisjmdavisp...@gmx.com wrote:
That page says that reads and writes are guaranteed to be atomic for
shared. It does _not_ say that something like
On 12/03/2011 11:30 PM, Jonathan M Davis wrote:
On Saturday, December 03, 2011 22:56:41 Timon Gehr wrote:
On 12/03/2011 09:49 PM, Jonathan M Davis wrote:
On Saturday, December 03, 2011 21:41:45 Andrej Mitrovic wrote:
On 12/3/11, Jonathan M Davisjmdavisp...@gmx.com wrote:
That page says
On 12/02/2011 05:05 PM, Adam wrote:
To step back a bit, what is the *benefit* of not requiring a class
to be declared abstract if it does not override an abstract member?
It introduces implicit behavior and the potential for an additional
test case (in *what* sane world should I even HAVE to
On 12/02/2011 08:10 PM, Adam wrote:
A second possible use case:
class C(T): T{
// some declarations
}
Now you really want that template to be instantiable with T being
either
an abstract or a concrete class. Anything else is bound to become
extremely annoying.
Could you expand on
On 12/02/2011 09:05 PM, Timon Gehr wrote:
On 12/02/2011 08:10 PM, Adam wrote:
A second possible use case:
class C(T): T{
// some declarations
}
Now you really want that template to be instantiable with T being
either
an abstract or a concrete class. Anything else is bound to become
On 12/02/2011 09:27 PM, Adam wrote:
So this pattern allows you to provide partial implementations of an
abstract, and use template specialization to provide a sort of
multiple inheritance rather than strict class definition /
extension. That's important in Scala because of the lack of multiple
On 12/01/2011 07:42 PM, Nick Sabalausky wrote:
Is there an easy way to profile DMD similar to how DMD itself has
the -profile switch?
Use DMC, I guess. http://www.digitalmars.com/ctg/trace.html
On 11/30/2011 07:53 PM, bioinfornatics wrote:
Variant is very usefull but a function who take a variant as parameter
do not works whithout a cast. but You can assign a value form any type
in statement Variant v = 2u.
the code below explain well the problem
---
import std.string;
On 11/30/2011 11:55 PM, bioinfornatics wrote:
Le mercredi 30 novembre 2011 à 22:19 +0100, Timon Gehr a écrit :
On 11/30/2011 07:53 PM, bioinfornatics wrote:
Variant is very usefull but a function who take a variant as parameter
do not works whithout a cast. but You can assign a value form any
On 12/01/2011 12:08 AM, Stewart Gordon wrote:
On 21/11/2011 20:06, Jesse Phillips wrote:
What you are describing is Head Const, and is not available.
http://www.d-programming-language.org/const-faq.html#head-const
It will not be added as it doesn't provide any guarantees about the
code that
On 11/28/2011 07:37 AM, breezes wrote:
Thanks. It seems that I have to write two classes, one synchronized and one is
not. Of course the
synchronized one should be the wrapper.
However, all members of a synchronized class are also shared. So I can not use
the un-synchronized class
in the
On 11/21/2011 03:04 PM, Alex Rønne Petersen wrote:
Hi,
Is there any way to make a variable single-assignment, regardless of its
type? I.e.:
void foo()
{
some magical keyword? int i = 0;
i = 2; // Error: i cannot be reassigned
}
I realize const and immutable will do this, but they are
On 11/17/2011 03:19 PM, Steven Schveighoffer wrote:
On Wed, 16 Nov 2011 17:39:16 -0500, Timon Gehr timon.g...@gmx.ch wrote:
On 11/16/2011 10:56 PM, Steven Schveighoffer wrote:
On Wed, 16 Nov 2011 16:16:48 -0500, Timon Gehr timon.g...@gmx.ch
wrote:
On 11/16/2011 09:00 PM, Steven
On 11/17/2011 06:12 PM, Tobias Pankrath wrote:
It would be cool, if the following would be possible.
immutable string MemberID = M;
struct A {}
struct B {
alias A M;
}
template Member(T)
{
static if(__traits(hasMember, T, MemberID))
{
alias __traits(getMember, T,
On 11/17/2011 06:41 PM, Timon Gehr wrote:
On 11/17/2011 06:12 PM, Tobias Pankrath wrote:
It would be cool, if the following would be possible.
immutable string MemberID = M;
struct A {}
struct B {
alias A M;
}
template Member(T)
{
static if(__traits(hasMember, T, MemberID))
{
alias
On 11/17/2011 07:23 PM, Steven Schveighoffer wrote:
On Thu, 17 Nov 2011 12:31:58 -0500, Timon Gehr timon.g...@gmx.ch wrote:
On 11/17/2011 03:19 PM, Steven Schveighoffer wrote:
What does writelnInferConst!T do? I'm afraid I'm not getting what you
are saying.
I was thinking writeln should
On 11/16/2011 02:22 PM, Steven Schveighoffer wrote:
On Tue, 15 Nov 2011 13:45:02 -0500, Timon Gehr timon.g...@gmx.ch wrote:
On 11/15/2011 04:53 PM, Steven Schveighoffer wrote:
Yes, but this is spelled out because copying a static array requires
moving data. However, this does *not* require
On 11/16/2011 08:26 PM, Timon Gehr wrote:
auto a = [new Foo, new Bar, new Qux]; // I want that to work.
(It currently does, if that was unclear)
601 - 700 of 837 matches
Mail list logo