On 1/30/15 7:29 PM, Ali Çehreli wrote:
On 01/30/2015 01:28 PM, Ary Borenszweig wrote:
> On 1/30/15 5:28 PM, Ali Çehreli wrote:
>> On 01/30/2015 11:59 AM, chardetm wrote:
>>
>> > struct Container {
>> >
>> > private RedBlackTree!int _rbtr
On 1/30/15 5:28 PM, Ali Çehreli wrote:
On 01/30/2015 11:59 AM, chardetm wrote:
> struct Container {
>
> private RedBlackTree!int _rbtree = new RedBlackTree!int;
I think you are expecting the new expression to be be executed for every
object individually. It is not the case: That new exp
On 11/29/14, 3:48 PM, ketmar via Digitalmars-d-learn wrote:
On Sat, 29 Nov 2014 15:37:32 +
Joakim via Digitalmars-d-learn
wrote:
build time for the whole DMD compiler with standard library,
using
G++: 100 seconds. yea, no kidding.
gdc: i don't even want to think about that, way t long
On 11/21/14, 2:46 PM, Adam D. Ruppe wrote:
On Friday, 21 November 2014 at 17:43:27 UTC, Ary Borenszweig wrote:
What's concatenation by juxtaposition?
When "foo" "bar" turns into "foobar". The two string literals are right
next to each other, no operator o
On 11/21/14, 1:59 PM, "Marc Schütz" " wrote:
On Friday, 21 November 2014 at 15:00:31 UTC, ketmar via
Digitalmars-d-learn wrote:
On Thu, 20 Nov 2014 14:23:23 -0300
Ary Borenszweig via Digitalmars-d-learn
wrote:
This way you avoid silly typing mistakes while at the same
On 11/20/14, 9:05 AM, uri wrote:
On Thursday, 20 November 2014 at 10:41:24 UTC, bearophile wrote:
uri:
It's by design
And it's a nice handy design.
Bye,
bearophile
For Wysiwyg strings I agree that it's great but I prefer C/C++/Python
like behaviour for double quoted strings. I guess it's
On 9/4/14, 7:03 PM, "Nordlöw" wrote:
On Thursday, 4 September 2014 at 22:02:20 UTC, Nordlöw wrote:
D can also, in this case, do (or will do) common sub-expression
elimination because it has a strict memory model (const and
immutability) and function purity (template inference).
Correction: foo
On 9/4/14, 5:03 PM, "Nordlöw" wrote:
Are there any programming languages that extend the behaviour of
comparison operators to allow expressions such as
if (low < value < high)
?
This syntax is currently disallowed by DMD.
I'm aware of the risk of a programmer misinterpreting this as
On 8/29/14, 10:41 AM, Mike James wrote:
Hi,
Looking at the DMD Source Guide it says "The lexer transforms the file
into an array of tokens."
Why is this step taken instead of, say, just calling a function that
returns the next token (or however many required for the look-ahead)?
Regards,
-=
On 8/21/14, 6:38 AM, MarisaLovesUsAll wrote:
tl;dr - how to get child classname from inherited parent function at
compile time?
class A { string getName(); };
class B { };
B foo = new B;
assert(foo.getName() == "B");
...
Hi! I'm stuck at one issue, and I don't know how to solve it. I think
this
On 8/12/14, 6:31 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Aug 12, 2014 at 08:23:30PM +, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Tuesday, 12 August 2014 at 19:03:58 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
tl;dr: there are so many ways template code can go wron
On 8/6/14, 2:59 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Wed, Aug 06, 2014 at 05:54:23PM +, Patrick via Digitalmars-d-learn wrote:
I know that there is no prescribed order that the .values array will
be sorted in, however I'm curious if the order is deterministic based
on keys.
If I
On 7/25/14, 6:39 PM, Jonathan M Davis wrote:
On Friday, 25 July 2014 at 21:33:23 UTC, Timothee Cour via
Digitalmars-d-learn wrote:
Is there a function for doing this?
myrange.at(i)
(with meaning of myrange.dropExactly(i).front)
it's a common enough operation (analog to myrange[i]; the naming is
On 7/25/14, 1:06 PM, Justin Whear wrote:
On Thu, 24 Jul 2014 22:00:43 +, Pavel wrote:
On Thursday, 24 July 2014 at 16:09:25 UTC, Justin Whear wrote:
On Thu, 24 Jul 2014 16:04:01 +, Pavel wrote:
Thanks to all you folks who explained "in" operator for me. My bad.
Let's focus on the rea
On 7/24/14, 1:58 PM, Justin Whear wrote:
On Thu, 24 Jul 2014 13:49:27 -0300, Ary Borenszweig wrote:
Nope, a JSON can only be an array or an object (hash).
Ary, can you point out the place in the spec where this is specified?
Not to be pedantic, but the spec only seems to define a "JSON
On 7/24/14, 1:09 PM, Justin Whear wrote:
On Thu, 24 Jul 2014 16:04:01 +, Pavel wrote:
Thanks to all you folks who explained "in" operator for me. My bad.
Let's focus on the real problem, which is JSON wrapper class. Is it
needed? Wouldn't it be better to get AA from parseJSON?
The followi
On 7/16/14, 10:22 AM, bearophile wrote:
Kagamin:
Report for the problem when a temporary fixed-size array is assigned
to a slice, which is escaped.
I think this is already in Bugzilla. But the point is: you can't solve
this problem locally and with small means. You need a principled
solution
On 7/11/14, 4:46 AM, bearophile wrote:
pgtkda:
How can i get the number of items which are currently hold in a DList?
Try (walkLength is from std.range):
mydList[].walkLength
Bye,
bearophile
So the doubly linked list doesn't know it's length? That seems a bit
inefficient...
On 6/28/14, 6:21 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Sat, Jun 28, 2014 at 05:40:19PM -0300, Ary Borenszweig via
Digitalmars-d-learn wrote:
This doesn't work:
class Foo {
this() {
this = new Foo;
}
}
Error: Cannot modify 'this'
However you can do t
This doesn't work:
class Foo {
this() {
this = new Foo;
}
}
Error: Cannot modify 'this'
However you can do this:
class Foo {
this() {
auto p = &this;
*p = new Foo();
}
}
It even changes the value of this!
Should that compile? I mean, it's the same as modifying 'this'...
On 6/24/14, 4:13 PM, Jacob Carlborg wrote:
On 2014-06-24 04:34, John Carter wrote:
So in Ruby and R and Scheme and... I have happily used map / collect for
years and years.
Lovely thing.
So I did the dumb obvious of
string[] stringList = map!...;
And D barfed, wrong type, some evil volde
On 6/23/14, 6:18 PM, John Carter wrote:
I guess between perl and Ruby and Scheme etc. I got used to creating
hybrid containers
Want a pair of [string, fileList]? Just make an Array with two items,
one a string, one and array of strings. Done.
D barfed... leaving me momentarily stunned... th
On 5/15/14, 1:31 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Thu, 15 May 2014 01:29:23 +
Kapps via Digitalmars-d-learn wrote:
On Wednesday, 14 May 2014 at 23:50:34 UTC, Meta wrote:
On the topic of lazy, why *is* it so slow, exactly? I thought
it was just shorthand for taking a
On 5/13/14, 5:43 PM, anonymous wrote:
On Tuesday, 13 May 2014 at 19:53:17 UTC, Tim Holzschuh via
Digitalmars-d-learn wrote:
If I also want to create a RegEx to filter string-expressions a la "
xyz ", how would I do this?
At least match( src, r"^\" (.*) $\" " ); doesn't seem to work and I
couldn
On 5/12/14, 5:37 AM, JR wrote:
Given that...
1. importing a module makes it compile the entirety of it, as well as
whatever it may be importing in turn
2. templates are only compiled if instantiated
3. the new package.d functionality
...is there a reason *not* to make every single function/stru
On 5/4/14, 6:04 PM, Mark Isaacson wrote:
I'm looking for a means to associate a key with a value and iterate over
said container in-order. My natural choice in C++ would be std::map.
When I look in std.container, I see that there is a RedBlackTree
implementation, however this does not associate
On 3/26/14, 11:47 AM, Adam D. Ruppe wrote:
On Wednesday, 26 March 2014 at 14:16:08 UTC, Ary Borenszweig wrote:
I'd like to generate a toString() method for my classes. For example:
Try this:
override string toString() {
import std.conv;
string s;
On 3/26/14, 11:47 AM, Adam D. Ruppe wrote:
On Wednesday, 26 March 2014 at 14:16:08 UTC, Ary Borenszweig wrote:
I'd like to generate a toString() method for my classes. For example:
Try this:
override string toString() {
import std.conv;
string s;
Hi,
I'd like to generate a toString() method for my classes. For example:
---
import std.stdio;
class Foo {
int x;
int y;
// mixin ...?
}
void main() {
auto foo = new Foo;
foo.x = 1;
foo.y = 2;
writeln(foo); // prints "Foo(x = 1, y = 2)"
}
---
I tried using getAllMembers, but t
On 3/17/14, 12:11 PM, Spacen Jasset wrote:
On Monday, 17 March 2014 at 14:39:16 UTC, Adam D. Ruppe wrote:
On Monday, 17 March 2014 at 14:31:54 UTC, Spacen Jasset wrote:
Thanks. What devilish magic allows for the syntax 60.days? (how does
it work)
There's a function in core.time:
Duration day
Hi,
I just read this nice article about slices:
http://dlang.org/d-array-article.html
So I tried this code to see if I understood it correctly:
---
import std.stdio;
void main() {
auto a = new int[5];
auto b = a;
a[0] = 1;
for(auto i = 0; i < 100; i++) {
a ~= 0;
}
a[0] = 2
On 1/28/14, 3:17 PM, Chris wrote:
On Tuesday, 28 January 2014 at 17:18:44 UTC, Ary Borenszweig wrote:
On 1/28/14, 11:30 AM, bearophile wrote:
Ary Borenszweig:
In Ruby you can do this:
class Foo
def end
1
end
end
Foo.new.end
Ruby is a different language from D, they define "
On 1/28/14, 11:30 AM, bearophile wrote:
Ary Borenszweig:
In Ruby you can do this:
class Foo
def end
1
end
end
Foo.new.end
Ruby is a different language from D, they define "code safety" in quite
different ways.
Bye,
bearophile
Having a method named "end" doesn
On 1/28/14, 10:00 AM, "Ola Fosheim Grøstad"
" wrote:
On Tuesday, 28 January 2014 at 12:58:29 UTC, Stanislav Blinov wrote:
I really wonder whether the rule could be relaxed a little bit.
o_O How?
If "body" never appears after a ".", and is only before a "{" then there
is no conflict?
Exact
On 12/11/13 8:05 AM, bioinfornatics wrote:
On Wednesday, 11 December 2013 at 11:00:40 UTC, QAston wrote:
On Wednesday, 11 December 2013 at 10:49:43 UTC, bioinfornatics wrote:
Hi,
Little question,
I'm looking a jdbc like in D ?
Does this exists ?
Thanks
https://github.com/buggins/ddbc - see
On 12/5/13 4:59 PM, Maxim Fomin wrote:
t and have these surprises all of the time just because "a negative
length doesn't make sense"... I don't know, I feel it's not the right
way to do it.
ulong, it's the same thing.
On 12/5/13 4:35 PM, H. S. Teoh wrote:
On Thu, Dec 05, 2013 at 03:47:27PM -0300, Ary Borenszweig wrote:
[...]
Cough, cough, make array length be an int.
Do you really need arrays that big? :-S
(I'm talking to Mr. D Compiler here)
A negative length array makes no sense.
Of course not
On 12/5/13 2:15 PM, Steve Teale wrote:
Here I feel like a beginner, but it seems very unfriendly:
import std.stdio;
struct ABC
{
double a;
int b;
bool c;
}
ABC[20] aabc;
void foo(int n)
{
writefln("n: %d, aabc.length: %d", n, aabc.length);
if (n < aabc.length)
write
On 11/26/13 7:00 PM, Namespace wrote:
On Tuesday, 26 November 2013 at 21:37:49 UTC, Jonas Drewsen wrote:
Isn't it a bug that the assertion is triggered for this:
class Test3 {}
void main()
{
assert( (new Test3()) == (new Test3()) );
}
Tried it on http://dpaste.dzfl.pl/ as well.
/Jonas
On 11/23/13 7:57 PM, H. S. Teoh wrote:
void delegate(Event) dg = (Event e) {
if (e == ...)
queue.remove(dg); // NG: Still complains 'dg' isn't
defined
};
Split it in declaration and initialization:
void delegate(Event) dg;
dg = (Event e) {
On 11/16/13 7:41 AM, Max Klyga wrote:
On 2013-11-16 05:04:20 +, Jonathan M Davis said:
I really don't understand this. Optional is one of the most useless
ideas
that I've ever seen in Java. Just use null.
Optional specifies explicitly that value can be absent and forces client
to check be
On 8/14/13 2:26 PM, Andre Artus wrote:
On Sunday, 11 August 2013 at 17:01:46 UTC, Yota wrote:
On Friday, 9 August 2013 at 17:35:18 UTC, monarch_dodra wrote:
On Friday, 9 August 2013 at 15:28:10 UTC, Manfred Nowak wrote:
michaelc37 wrote:
WTF -> -1 is greater than 7
From the docs:
It i
On 7/31/13 12:56 PM, H. S. Teoh wrote:
On Wed, Jul 31, 2013 at 12:51:25PM -0300, Ary Borenszweig wrote:
On 7/31/13 12:05 PM, bearophile wrote:
Daniel Kozak:
is there a way for AA to behave same as PHP?
D associative arrays are based on hashing, so they do not keep the
order of the items
On 7/31/13 12:05 PM, bearophile wrote:
Daniel Kozak:
is there a way for AA to behave same as PHP?
D associative arrays are based on hashing, so they do not keep the order
of the items. This is true in Python too. The Python standard library
has a hash-based ordered dict that keeps the insert
On 7/17/13 11:38 AM, JS wrote:
On Wednesday, 17 July 2013 at 14:18:25 UTC, John Colvin wrote:
On Wednesday, 17 July 2013 at 14:09:28 UTC, JS wrote:
Ok, spoke too soon again,
my string requires compound splitting:
foreach(ss; split(s, ","))
{
split(ss, "|"); // ss can't be read at compile t
On 7/17/13 4:33 AM, Jacob Carlborg wrote:
On 2013-07-17 05:27, JS wrote:
With heavy ctfe code generation usage is it possible to have the d
compiler output the source code after all mixin templates have been
"used"? This way it is easier to visually check for errors in the
generated code.
I ima
On 7/12/13 5:38 PM, ixid wrote:
On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
ixid:
Similarly what are D user's potential issues with Go-like semi-colon
rules? And would this be possible as a subset of current D code?
Such changes will not happen even in D4. Walter is strongly a
On 3/8/13 10:33 AM, Andrea Fontana wrote:
I wonder if exists a way to get top n distinct elements from a range
(infinite too!)
Top from an infinite range? o_O
On 2/21/13 8:34 PM, Jonathan M Davis wrote:
On Friday, February 22, 2013 00:06:26 bearophile wrote:
Jonathan M Davis:
D doesn't
bother to check, so you get the natural consequence of mixing
them. I'm quite
sure that the fact that it works that way is an accident. It
was never
intentially made t
On 2/17/13 7:25 PM, Jonathan M Davis wrote:
On Sunday, February 17, 2013 23:00:19 Michael wrote:
That's not the meaning of static in that context.
As I understand a static class can't be instantiated.
I have no idea how you came to that conclusion.
Probably because of this:
http://msdn.mi
On 2/7/13 5:20 PM, Dan wrote:
For an associative array, what is the best idiom that allows for
checking if a key exists in the AA. If it does do something with the
value, if not initialize the value and then do something with it.
In this code: http://dpaste.dzfl.pl/daab318f
How would this piece
On Thursday, 10 January 2013 at 17:36:15 UTC, Raphaël Jakse wrote:
Le 10/01/2013 10:23, monarch_dodra a écrit :
On Thursday, 10 January 2013 at 03:29:21 UTC, Peter Summerland
wrote:
The only thing I'd want to be able to do is:
//
foreach ( ; 0 .. 5)
{
writeln("hello");
}
//
If I d
On 05/29/2010 06:38 PM, Duke Normandin wrote:
Back again...
As an introductory tutorial, I'm now using:
http://www.dsource.org/projects/tutorials/wiki/InitializingVariablesExample
BTW, somebody fix that page - the `writefln' statements are missing
the %d and %s.
char[] password = "sesame";
d
Ary Borenszweig wrote:
strtr wrote:
Sorry, should have included this :)
module main;
import std.string;
import std.stdio;
enum ENUM { A,B }
char[] toString(ENUM e_){return "enum";}
void main (){
writefln( toString(3) );
writefln( toString(ENUM.A) );
}
--
main.d(
strtr wrote:
Sorry, should have included this :)
module main;
import std.string;
import std.stdio;
enum ENUM { A,B }
char[] toString(ENUM e_){return "enum";}
void main (){
writefln( toString(3) );
writefln( toString(ENUM.A) );
}
--
main.d(10): Error: function main.toStrin
Walter Bright wrote:
bearophile wrote:
Walter Bright:
Are you sure? What's the mistake in the code?
This is the code in the Overview, it prints 1899:
http://codepad.org/lzRtggEL
This is the code I have suggested in bugzilla, it prints 1027:
http://ideone.com/D9ZqQ
Wolfram Alpha says they ar
Nrgyzer wrote:
Hello everybody,
I'm trying to create a (very) simple DLL by using D. Now I want export values -
is there any way do this... for example:
Example:
mydll.d:
export int i;
mydll2.d:
export int i = 99;
dll.d:
// Copied from http://www.digitalmars.com/d/2.0/dll.html
test.d:
impo
Ellery Newcomer wrote:
Are there any good libraries for ctfe/code generation?
I don't know, things like parsing support for compile time strings,
string formatting, type <-> string
My project seems to be growing ctfe, and it's all horribly hacky and
ugly code.
I think all ctfe code is horr
Ellery Newcomer wrote:
Are there any good libraries for ctfe/code generation?
I don't know, things like parsing support for compile time strings,
string formatting, type <-> string
My project seems to be growing ctfe, and it's all horribly hacky and
ugly code.
I think all ctfe code is horr
Don wrote:
Ary Borenszweig wrote:
Don wrote:
Ary Borenszweig wrote:
Don wrote:
Lars T. Kyllingstad wrote:
Don wrote:
bearophile wrote:
So far I've just given a light reading of the code. Notes:
- pow(x, 2) and sqrt(y) can be written as x ^^ 2 and y ^^ 0.5
(but you have to i
bearophile wrote:
Ary Borenszweig:
My point is, if you are going to pow, you will need std.math, so it'll
always be a burden to import it by hand when using it. ^^
Can the automatic import happen only iff a module uses the ^^fp?
Bye,
bearophile
That's what I'm asking for.
Don wrote:
Ary Borenszweig wrote:
Don wrote:
Lars T. Kyllingstad wrote:
Don wrote:
bearophile wrote:
So far I've just given a light reading of the code. Notes:
- pow(x, 2) and sqrt(y) can be written as x ^^ 2 and y ^^ 0.5 (but
you have to import std.math anyway, because of
Don wrote:
Lars T. Kyllingstad wrote:
Don wrote:
bearophile wrote:
So far I've just given a light reading of the code. Notes:
- pow(x, 2) and sqrt(y) can be written as x ^^ 2 and y ^^ 0.5 (but
you have to import std.math anyway, because of a bug).
That's not a bug. It's intentional. x ^^
bearophile wrote:
While looking for possible attribute problems to add to Bugzilla, I have seen
the following D2 program compiles and runs with no errors or warnings:
static foo1() {}
final foo2() {}
ref foo3() {}
enum void foo5() {}
nothrow foo4() {}
pure foo6() {}
static int x1 = 10;
static
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 10:12:53 -0500, Ary Borenszweig
wrote:
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 09:38:08 -0500, Ary Borenszweig
wrote:
An instance of A can never be an A, so why the cast is allowed?
Aside from the typo, I agree with you there
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 09:38:08 -0500, Ary Borenszweig
wrote:
The following compiles:
import std.stdio;
interface I {
}
class A : I {
}
class B {
}
int main() {
I i = new A();
A a = cast(A) i;
B b = cast(B) i; // shouldn't compile
B c = cast
The following compiles:
import std.stdio;
interface I {
}
class A : I {
}
class B {
}
int main() {
I i = new A();
A a = cast(A) i;
B b = cast(B) i; // shouldn't compile
B c = cast(B) a; // shouldn't compile
writeln(a);
writeln(b);
writeln(c);
return 0;
}
But two lines there
Trass3r wrote:
Cast the instance to the base class and call the method?
Surprisingly this does compile.
What are the rules for casting between classes?
Normally you can cast A to B if B inherits from A. But this seems not to
be the case in D. The following compiles without complains:
impo
Don wrote:
BCS wrote:
Hello Ary,
Don wrote:
Phil Deets wrote:
On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
wrote:
Apart from C legacy, is there a reason to assume anything we don't
know what
is, is an int? Shouldn't the compiler instead say 'unknown type' or
something
else that ma
Don wrote:
Phil Deets wrote:
On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
wrote:
Apart from C legacy, is there a reason to assume anything we don't
know what
is, is an int? Shouldn't the compiler instead say 'unknown type' or
something
else that makes sense?
C++ abandoned default
bearophile wrote:
Tomek Sowiñski:
How do I achieve this with std.format?
I think you can't (and I haven't had the need to do it).
It's somtimes needed with I18N code.
Ellery Newcomer wrote:
On 11/30/2009 12:32 PM, Chad J wrote:
Ellery Newcomer wrote:
On 11/30/2009 03:53 AM, Ary Borenszweig wrote:
Chad J wrote:
Given an Expression object in dmd, I'd like to know how many
subexpressions it contains and, even better, iterate over them. I'd
like to
Chad J wrote:
Given an Expression object in dmd, I'd like to know how many
subexpressions it contains and, even better, iterate over them. I'd
like to do this in a general way, without having to create cases for all
of the different kinds of Expressions. Is there some way to do this
that I've b
Michael Mittner wrote:
Hi!
I'm trying to do something like this (in D1):
class Foo
{
// ...
}
class Bar(T) : Foo
{
// ...
}
alias Bar!(int) IntBar;
alias Bar!(Mars) MarsBar;
void main()
{
Foo x = new MarsBar();
}
Common base class, one derived template class and a bunch of alias
Sam Hu wrote:
Greetings!
How to set value to non-static variable in a static method within a class?
Given below code:
import std.stdio;
class InputDialog
{
string name;
static string s_name;
static this()
{
s_name="";
Simen Kjaeraas wrote:
Ary Borenszweig wrote:
How can I know at compile time if all of the following are true for a
given symbol s:
1. s is a function
2. the return type is a class that extends from class foo.Bar
3. the function has three arguments and it is not variadic
4. the first
How can I know at compile time if all of the following are true for a
given symbol s:
1. s is a function
2. the return type is a class that extends from class foo.Bar
3. the function has three arguments and it is not variadic
4. the first argument is an int
5. the second argument is a struct
bearophile wrote:
Steven Schveighoffer:
int c = (){return a + b;}();
You can also write:
int c = {return a + b;}();
Bye,
bearophile
Shorter:
int c = a + b;
Joel Christensen wrote:
I've got one project working ok, but not another. Things like working at
the start of the main function but not at the end, and not in other
functions.
Hi Joel,
Do you have something in the Error Log (Window -> Show View -> Error
Log)? How is your project configured?
Phil Deets wrote:
On Thu, 29 Oct 2009 18:28:12 -0500, Ary Borenszweig
wrote:
Ellery Newcomer wrote:
Phil Deets wrote:
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it
Ellery Newcomer wrote:
Phil Deets wrote:
Hi, is there a way to add members to an enum based on conditional
compilation symbols. I tried
enum Tag {
A, B,
version (symbol) {
C, D,
}
E,
}
but it doesn't work. I know I could do
version (symbol) {
enum Tag { A, B, C, D, E }
}
Saaa wrote:
public void addToAA(char[] var_name, KT, ET)(KT key, ET element)
{
mixin(ET.stringof~`[]* elements = key in `~var_name~`;`);
if( elements == null )
{
ET[] temp;
temp.length = 1;
temp[0] = element;
mixin(var_name~`[key] = temp;`);
Why `key`? Where's `key` define
Steven Schveighoffer wrote:
On Mon, 12 Oct 2009 05:26:58 -0400, bearophile
wrote:
What's wrong with this code?
struct MemoryPool(T) {
alias T[100_000 / T.sizeof] Chunk;
Chunk*[] chunks;
}
struct Foo {
int x;
MemoryPool!(Foo) pool;
}
void main() {}
It prints "Error: struct pr
Jarrett Billingsley wrote:
On Thu, Oct 8, 2009 at 11:25 AM, Don wrote:
Jarrett Billingsley wrote:
On Thu, Oct 8, 2009 at 4:00 AM, Don wrote:
So it looks to me like the mechanics of it are basically identical.
Just Nemerle's syntax is nicer.
Only with trivial examples. With more complicated
Trass3r wrote:
Phil Deets schrieb:
I tried Descent, but it didn't work well at all with my D2 program. It
also didn't support building. I'll look into Poseidon. Thanks.
D2 support isn't that good in Descent yet.
Exactly. I think the parser is ported up to 2.030 but I didn't test it a
lot
Saaa wrote:
"Daniel Keep" wrote in message
news:h88cck$1or...@digitalmars.com...
Saaa wrote:
abstract class C
{
int method();
}
class C2:C
{
int method() return 2;
}
class C3:C
{
int method() return 3;
}
int delegate() deleg;
void main()
{
C c;
C2 c2 = new C2;
C3 c3 = new C3;
c=c2;
c
Sam Hu escribió:
div0 Wrote:
You must have two different HANDLEs around.
The one in phobos is aliased to void* and there is no LoadLibraryEx call
in phobos, so you must be using something else.
Try using the FQN of the import where you are getting the LoadLibraryEx
from.
Thanks for your help.
Hi,
I'm trying to fetch a module's dependencies with the deps switch, but it
gives me an empty list.
dmd main.d -deps=foo.txt
foo.txt is empty.
main.d is:
---
module main;
import other;
int main(char[][] args) {
someVariable = 3;
return 0;
}
---
and someVariable is define
Josh escribió:
Jeez. I forgot to add my compile command, here is it:
dfl -release -gui maindialog.d
I think you have to pass it the other files too:
dfl -release -gui maindialog.d common/globals.d (etc.)
Steven Schveighoffer escribió:
On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer
wrote:
void blah(out bool a = false){
// blah blah blah
}
compile time use of blah results in error.
Am I doing anything wrong?
out implies a reference. You can't have a reference to a manifest
constant
div0 wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Ary Borenszweig wrote:
div0 wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jarrett Billingsley wrote:
On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote:
That's what he's suggesting, and it does make sense. When you write
div0 wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jarrett Billingsley wrote:
On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote:
That's what he's suggesting, and it does make sense. When you write a
template, *either* it's meant to be used as a mixin, *or* it's meant
to be used some other wa
bearophile escribió:
Jarrett Billingsley:
C++ has static initialization that occurs before main() too. It's just..
hidden.<
I see. I have to learn more about C++. Thank you.
--
Lars T. Kyllingstad:
This is good news! The restrictions you are referring to, are they any of t
Harry escribió:
Again hello,
char[6] t = r"again" ~ cast(char)7 ~ r"hello";
If you want the result to be "again7hello", then no. You must do:
char[6] t = r"again" ~ '7' ~ r"hello";
or:
char[6] t = r"again" ~ (cast(char)('0' + 7)) ~ r"hello";
Saaa escribió:
struct S
{
int i;
}
S[char[]] aa;
void main() {
aa["test"].i = 10;
}
Error: ArrayBoundsError
D1.046
looks like a bug to me or can't structs be aa's?
But you never inserted anything in aa["test"].
You must do:
S s;
aa["test"] = s;
aa["test"].i = 10;
or:
S s;
s.i = 10;
a
asd escribió:
thanks for quick response!
Lutger Wrote:
Not directly except with descent. It's worth it to try descent compile time
debugger (and compile time view!), really awesome stuff.
It's indeed pretty nice, but unfortunately it doesn't seem to show mixins:
public void STARTS
Ary Borenszweig escribió:
asd escribió:
thanks for quick response!
Lutger Wrote:
Not directly except with descent. It's worth it to try descent
compile time debugger (and compile time view!), really awesome stuff.
It's indeed pretty nice, but unfortunately it doesn't seem
Ary Borenszweig wrote:
asd wrote:
I'm trying to get D-ObjC bridge working and I'm getting weird errors
triggered somewhere deeply in a mix of templates and mixins that's too
hard for me to understand.
How can I analyze such problem in D? Is it possible to tell dmd to run
on
asd wrote:
I'm trying to get D-ObjC bridge working and I'm getting weird errors triggered
somewhere deeply in a mix of templates and mixins that's too hard for me to
understand.
How can I analyze such problem in D? Is it possible to tell dmd to run only
compile-time functions/templates and ou
Brad Roberts escribió:
Jarrett Billingsley wrote:
On Tue, Jul 21, 2009 at 11:53 PM, Brad Roberts wrote:
Jesse Phillips wrote:
On Wed, 22 Jul 2009 01:37:38 +0100, Stewart Gordon wrote:
Jesse Phillips wrote:
According to the documentation having & in a tag will be turned to
&
http://digitalm
1 - 100 of 143 matches
Mail list logo