On Sun, 26 Dec 2010 12:06:04 -0800
Walter Bright newshou...@digitalmars.com wrote:
11. generative programming
Does someone have a pointer to any kind of doc about this? (in D)
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
On Sun, 26 Dec 2010 22:44:04 +0100
Jérôme M. Berger jeber...@free.fr wrote:
8. direct interface to C
Cython gives it too: it is as easy to write a Cython interface
module as to write a D interface file for a C library.
Hum, I do not agree at all. As I see it, D binds to C directly, Lua
On Mon, 27 Dec 2010 05:22:14 -0200
Guilherme Vieira n2.nitro...@gmail.com wrote:
Right now I'm wondering how's the best way to create a dynamic array object
which will only accept unique elements (i.e., elements != from the
existing elements in the array).
(Take my words with precaution
On Sun, 26 Dec 2010 00:45:42 -0500
bearophile bearophileh...@lycos.com wrote:
You need to add some shades of grey to your palette. break, continue and goto
are bad, and it's better to limit their usage.
You need to soften your rocks of certitudes, Bearophile.
cycle
On Sun, 26 Dec 2010 00:36:26 + (UTC)
Tomek Sowiński j...@ask.me wrote:
proposed
A random-access range is a bidirectional range OR an infinite forward
range that offers the primitive opIndex.
/proposed
I can't be sure whether the former should also provide the primitive
Hello,
I have a problem with D's auto-init feature. When reading in someone else's code
int i;
there is no way, I guess, to know whether this means i is initialised to 0 or
i is left undefined. For this reason, in the former case I do explicitely
initialise. Thus,
int i = 0;
On Sun, 26 Dec 2010 14:54:12 +0100
Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
int i;// auto-initialized to int.init
int i = void; // not initialized
Thanks. Actually this solves my semantic issue, did not even think at 'void'.
(I will use it often). By the way, I don't want to play
Hello,
I need to test in sequence the bits of an unsigned int (see below more
precision), and move in a tree accordingly. Since there are 2 possible branches
at every step, they are encoded in a [2] array, indexed by bit. I am looking
for the fastest way to get that bit.
To run backwards (MSB
On Sun, 26 Dec 2010 13:40:22 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
foreach (i ; 0..BIT_SIZE) {
mask = MASKS[i];
bit = !!(code mask);
node = node.nodes[bit];
}
But as you see masking that way lets a value of 2^i, not 1, in the
'true'
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
On Sun, 26 Dec 2010 17:54:22 +0300
Stanislav Blinov stanislav.bli...@gmail.com wrote:
Hello,
If I have
class Node (Element) {...}
can I subtype it like with
class Leaf (Element) : Node (Element) {...}
or such?
Denis
Absolutely:
class Leaf(Element) : Node!Element
On Sat, 25 Dec 2010 04:06:15 -0500
bearophile bearophileh...@lycos.com wrote:
I am far from being an expert C++ (or OOP) programmer still, so probably some
of my needs look (or are) naive.
This looks related to the old discussion of a 'scoped' attribute for class
members, but it's a
On Sat, 25 Dec 2010 11:08:17 -0500
bearophile bearophileh...@lycos.com wrote:
Well the built-in AAs are unordered sets.
Built-in AAs are not sets because they force you to keep a value associated
with each key (so they use more memory than a set) and their syntax requires
a value for
On Sat, 25 Dec 2010 18:46:17 + (UTC)
Tomek Sowiński j...@ask.me wrote:
dsimcha dsim...@yahoo.com wrote:
I've been thinking about adding purity to various parts of Phobos and
one
thing that limits this in the case of containers is templated
containers,
arrays, etc. that may be
On Sat, 25 Dec 2010 11:46:43 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
On 12/25/10 10:08 AM, bearophile wrote:
Andrei:
What is a pure hash map?
I meant that to implement the dict protocol in Python you just need to
implement an equality and an __hash__ methods,
On Sat, 25 Dec 2010 14:03:42 -0800
Walter Bright newshou...@digitalmars.com wrote:
bearophile wrote:
Structured programming is good because it usually helps code readability.
But
it's not Verb, so in some less common cases a goto, break or continue help
improve the code.
Misra C
On Thu, 23 Dec 2010 23:18:06 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
module testmodule;
import std.string : split;
import std.stdio : writeln;
string modulename = split(.stringof)[1];
void main()
{
writeln(modulename);
}
What the... I didn't
On Fri, 24 Dec 2010 18:33:04 + (UTC)
Mandeep Singh Brar mand...@brars.co.in wrote:
Hi,
Can you please help me/point me to the usage for std.encoding
package.I think i was successfully able to encode a string into
byte array using the following code:
string x = test;
the correct list
of modules ;-) (so that solving the issue about C files is then 3s work).
@spir: rdmd's command-line syntax is like this:
rdmd {args to dmd and rdmd} app.d {args sent to app.exe}
So anything after the first *.d param is automatically considered a param
for when rdmd runs
On Wed, 22 Dec 2010 20:16:45 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
Thanks for posting the numbers. That's a long time, particularly
considering that the two map instances don't do anything. So the bulk of
the computation is:
auto L = iota(0.0, 1000.0);
auto V
On Wed, 22 Dec 2010 22:14:34 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
I then replaced iota's implementation with a simpler one that's a
forward range. Then the performance became exactly the same as for the
simple loop.
After having watched Iota's very general
On Wed, 22 Dec 2010 23:22:56 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
I'm thinking what to do about iota, which has good features but exacts
too much cost on tight loop performance. One solution would be to define
iota to be the simple, forward range that I defined as
On Thu, 23 Dec 2010 05:29:32 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
On Thursday 23 December 2010 05:22:55 spir wrote:
On Wed, 22 Dec 2010 23:22:56 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
I'm thinking what to do about iota, which has good features
On Thu, 23 Dec 2010 14:40:13 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
What kind of thingie does i..j actually construct as of now?
Nothing. The syntax only works in foreach and opSlice.
However, this works:
final abstract class Intervals {
struct Interval( T ) {
On Thu, 23 Dec 2010 17:41:06 +0100
Thomas Mader thomas.ma...@gmail.com wrote:
I think it's very important for D to step into the corporate world to
get more stability, a bigger community and therefore a stronger toolchain.
For this to happen companies need trust in the future of the project
On Thu, 23 Dec 2010 00:34:41 -0600
Christopher Nicholson-Sauls ibisbase...@gmail.com wrote:
On 12/22/10 15:06, Andrej Mitrovic wrote:
Oooh. That cought me off guard, sorry.
Thanks Steve.
I'll concede that the syntax can be odd at first, but it also enables
some interesting things.
Hello,
Say I have a project with the following tree structure:
[app]
app.d
util.d
[test]
test.d
[data]
data.d
Is there a way to import util data from test?
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
On Thu, 23 Dec 2010 05:26:57 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
On Thursday 23 December 2010 04:38:56 spir wrote:
Hello,
Say I have a project with the following tree structure:
[app]
app.d
util.d
[test]
test.d
[data
On Thu, 23 Dec 2010 12:54:42 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
What you're trying to do is pretty abnormal really, as far as your average
module goes. I assume that you're writing a test app which needs access to
the
main body of code and are trying to find a way to point
Hello,
Is it possible use rdmd (to automagically link against imported D modules),
when also calling C funcs? I tried to add the C file at the end of the building
command, like eg (removed all dmd options):
rdmd --build-only -ofmyProg myProg.d myCFuncs.o
but rdmd does not seem to
On Wed, 22 Dec 2010 17:04:21 -0500
Andreas Mayer s...@bacon.eggs wrote:
To see what performance advantage D would give me over using a scripting
language, I made a small benchmark. It consists of this code:
auto L = iota(0.0, 1000.0);
auto L2 = map!a / 2(L);
auto L3 =
On Wed, 22 Dec 2010 18:26:33 -0500
Gary Whatmore n...@spam.sp wrote:
Ary Borenszweig Wrote:
You said Lua is a joke language. It doesn't seem to be one...
Okay then, maybe it's not completely true. I meant it doesn't work in large
scale applications unlike a static systems programming
On Wed, 22 Dec 2010 19:40:16 -0500
g g h...@www.com wrote:
Thanks for the answers
what I did is this ( i feel that it is quite clumsy):
Node* x = cast(Node*) (GC.malloc(Node.sizeof));
*x = xa;
x.up = curnode;
...
This is not that clumsy (except for you
On Tue, 21 Dec 2010 09:53:49 +0530
d coder dlang.co...@gmail.com wrote:
Greetings
I want to find if a given struct type is instantiated from a
particular template struct type. For example:
struct S (T) {
alias T Type;
T t;
}
And later I want to find out if a given type is of
On Tue, 21 Dec 2010 11:49:42 -0500
Steven Schveighoffer schvei...@yahoo.com wrote:
Hm... I always use a newsgroup client, so maybe. But in any case, I've
never known anyone to have been blocked from posting, and the newsgroup
interface does not have any moderation on it. I'd be surprised
On Mon, 20 Dec 2010 12:29:29 -0500
Steven Schveighoffer schvei...@yahoo.com wrote:
This example is misleading. First, catching an exception should be a rare
occurrence (literally, an exception to the rule). You are testing the
case where catching an exception vastly outweighs the cases
On Mon, 20 Dec 2010 04:27:33 +0300
Nick Voronin elfy...@gmail.com wrote:
On Mon, 20 Dec 2010 01:24:02 +0100
CrypticMetaphor crypticmetapho...@gmail.com wrote:
Anyway, the problem is, if I call rdmd from outside the folder in which
the main source resides in, and main includes another
On Sun, 19 Dec 2010 21:33:56 -0500
bearophile bearophileh...@lycos.com wrote:
So, putting classes on the stack kind of negates the whole point of having
both structs and classes in the first place.
This is false, the definition of D class instance doesn't specify where the
instance
On Mon, 20 Dec 2010 01:29:13 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
For me, the important difference is that classes are referenced, while
structs are plain values. This is a semantic distinction of highest
importance. I would like structs to be subtype-able and to implement
On Mon, 20 Dec 2010 03:11:49 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
Now, you could conceivably have a language where all of its objects were
actually pointers, but they were treated as value types. So,
B b;
A a = b;
would actually be declaring
B* b;
A* a = b;
Hello,
I had not initially noticed that the 'in' operator (for AAs) returns a pointer
to the looked up element. So that, to avoid double lookup in cases where
lookups may fail, I naively used try...catch. In cases of very numerous
lookups, my code suddenly became blitz fast. So that I
On Sun, 19 Dec 2010 05:19:50 -0500
bearophile bearophileh...@lycos.com wrote:
Yet I hope Walter will not waste 6 hours every day *playing* World of
warcraft :-)
rather The Battle for Wesnoth ;-)
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
On Sun, 19 Dec 2010 07:47:11 -0500
Michel Fortin michel.for...@michelf.com wrote:
On 2010-12-19 07:33:29 -0500, spir denis.s...@gmail.com said:
// pointer
t0 = time();
foreach (n ; 0..N2) {
p = (n in table);
if (p) b = table[n];
}
But why
On Sun, 19 Dec 2010 07:46:09 -0500
bearophile bearophileh...@lycos.com wrote:
spir:
try...catch version time: 387ms
pointer version time: 388ms
pointer version is about 40650 times faster
Those numbers look wrong :-)
I thought so. But in the real app a loop that lasted ~ 10s suddenly
On Sun, 19 Dec 2010 12:43:23 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
On 12/19/10 11:35 AM, Ary Borenszweig wrote:
On 12/19/2010 02:28 PM, Andrei Alexandrescu wrote:
On 12/19/10 11:23 AM, Ary Borenszweig wrote:
On 12/19/2010 02:17 PM, Andrei Alexandrescu wrote:
On
On Sun, 19 Dec 2010 14:14:08 -0500
Nick Sabalausky a...@a.a wrote:
Don't you all find it annoying to constantly keep whole threads, most of
which are to your answer irrelevant, just to reply a few word?. Please
instead keep only relevant snippet(s). Here the kept text is about 5kb.
On Sun, 19 Dec 2010 03:37:37 -0600
Christopher Nicholson-Sauls ibisbase...@gmail.com wrote:
On 12/18/10 07:19, spir wrote:
Hello,
I cannot find a way to define methods (I mean member functions) outside
the main type-definition body:
struct X {}
void X.say () {writeln(I say
On Fri, 17 Dec 2010 02:42:14 -0500
bearophile bearophileh...@lycos.com wrote:
http://www.reddit.com/r/programming/comments/enajl/purity_in_d_language/
Bye,
bearophile
I take the opportunity to question the def of weakly pure.
-1- How can this even compile?
pure append (ref int[] a,
On Sat, 18 Dec 2010 01:08:20 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
Thank you for the explanation about strongly pure funcs calling weakly pure
ones --this fully makes sense.
I would like weakly pure to include output funcs, and exclude all
possibilities to modify (non-local)
On Sat, 18 Dec 2010 13:09:19 +0100
David Nadlinger s...@klickverbot.at wrote:
On 12/18/10 12:52 PM, spir wrote:
Why? What is the rationale for excluding output (I don't mean I/O, only O)?
Where would be the difference between writing to a global variable and
writing to stdout?
How can
On Sat, 18 Dec 2010 13:46:11 +0100
Don nos...@nospam.com wrote:
spir wrote:
On Sat, 18 Dec 2010 01:08:20 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
Thank you for the explanation about strongly pure funcs calling weakly pure
ones --this fully makes sense.
I would like
On Sat, 18 Dec 2010 12:30:31 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
spir denis.s...@gmail.com wrote:
-1- How can this even compile?
pure append (ref int[] a, int i) {a ~= i;}
The _only_ task of this func is to change state.
It is designed to be usable in strongly pure
On Sun, 19 Dec 2010 01:24:43 + (UTC)
JRM a...@b.com wrote:
On Sat, 18 Dec 2010 16:01:37 -0800, Walter Bright wrote:
If size and simplicity of typing are critical, are those really better
than:
ab
?
I agree that those aren't really much better.
This entire discussion
On Sat, 18 Dec 2010 18:13:50 -0800
Walter Bright newshou...@digitalmars.com wrote:
you could write:
sort!(@1@2)(x);
[...]
I think this idea (or something similar) is worth consideration. It is
simply a small extension to an already existing feature that would give D
a terser
Hello,
In Lisp-like languages, a list can hold anything:
(1 a (1 a))
I do not find it trivial to simulate this in D. Using a linked list or an
array: the issue is not with the kind of collection but with elements. In
either case, I guess, elements should actually be void* pointers. But
Hello,
struct S {
int value;
void opAssign(int value) {
this.value = value;
}
}
unittest {
S s1;
s1 = 3; // OK
S s2 = 3; // _build_ error
}
==
Element.d(105): Error: cannot implicitly convert expression (3) of type int to S
Do I miss something? And why not
Hello,
I cannot find a way to define methods (I mean member functions) outside the
main type-definition body:
struct X {}
void X.say () {writeln(I say!);}
==
Element.d(85): semicolon expected, not '.'
Do I overlook anything, or is this simply impossible? In the latter case, what
is the
On Sat, 18 Dec 2010 13:07:41 +0100
Tomek Sowiński j...@ask.me wrote:
BTW, am I the only one to think Object.factory is a bad name? It doesn't
return a factory. Sure, one can get used to it, but why not Object.make or
.create or .instance?
You're not the only one ;-)
Similar to index(ing)
On Sat, 18 Dec 2010 13:35:21 +0100
David Nadlinger s...@klickverbot.at wrote:
But I could not find a way to do that, instead get weird error messages
like eg 'int' is not a value (so, what else?).
It is a type, and as such a compile-time entity rather than a runtime
value. You might
On Sat, 18 Dec 2010 13:08:14 +
Adam Burton adz...@gmail.com wrote:
struct S {
int value;
void opAssign(int value) {
this.value = value;
}
}
unittest {
S s1;
s1 = 3; // OK
S s2 = 3; // _build_ error
}
==
Element.d(105): Error: cannot
On Fri, 17 Dec 2010 03:05:02 +
Russel Winder rus...@russel.org.uk wrote:
On Thu, 2010-12-16 at 20:36 -0600, Craig Black wrote:
It was brought to my attention that the quick sort has a very bad worst
case, so I implemented a simple fix for it. Now the worst case (completely
ordered)
On Wed, 15 Dec 2010 23:07:46 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
It would be nice to get a fairly extensive lists of types to sort with a
variety
of values and number of values of those types and set up an extensive set of
benchmarking tests. Heck, such a set of types and
On Tue, 14 Dec 2010 13:57:43 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
Imagine now if I wanted to define a foo that worked only on my specific
range, I now have to go back and modify the constraints of all the other
functions. What if I don't have control over that
On Tue, 14 Dec 2010 09:35:20 -0500
Robert Jacques sandf...@jhu.edu wrote:
Having recently run into this without knowing it,
Which one? (This issue causes 3 distinct bugs.)
vote++. Also, please
file a bug report (or two).
Done: http://d.puremagic.com/issues/show_bug.cgi?id=5354 -- see
On Tue, 14 Dec 2010 18:24:09 -0500
bearophile bearophileh...@lycos.com wrote:
Yes, this is a common thing (it happened to me too, with Python and other
languages). You need to be careful and think three times before designing
things. Knowing several languages helps a bit against that.
On Wed, 15 Dec 2010 03:06 +0100
Jonathan Schmidt-Dominé de...@the-user.org wrote:
copy_if on a multidimensional container should not naively copy entire
hyperplanes. More generally, I think that whenever an arbitrarily large
object is to be copied, that should be explicit instead of
Hello,
see http://en.wikipedia.org/wiki/Type_class
I have tried several times to express the idea of using intervaces (only) for
template case selection. Instead of a combination of really penible hardly
readible is() expressions and adhoc functions like isRandomAccessRange. (No
chance in
On Tue, 14 Dec 2010 13:53:39 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
Coming from an STL background I was also very comfortable with the
notion of value. Walter pointed to me that in the STL what you worry
about most of the time is to _undo_ the propensity of objects
On Tue, 14 Dec 2010 22:11:59 +0100
Simon Buerger k...@gmx.net wrote:
So since we have the opportunity to decide now for eternity the right
thing, I think reference semantics works great with containers.
Indeed. Whichever way to go, you need a good reason.
There is not nay good technical
On Wed, 15 Dec 2010 14:34:47 + (UTC)
Lars T. Kyllingstad pub...@kyllingen.nospamnet wrote:
And if someone *really* wants to put the i in there, they can just
define it in their own app:
enum i = Complex!double(0, 1);
auto z = 0.998 + 2.72e-2*i;
+++
Denis
-- -- -- -- -- -- --
vit
On Wed, 15 Dec 2010 09:56:36 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
Optimization (or pessimization) is a concern, but not my primary one. My
concern is: most of the time, do you want to work on a container or on a
copy of the container? Consider this
On Wed, 15 Dec 2010 11:57:32 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
On 12/15/10 11:05 AM, spir wrote:
What I'm trying to fight is beeing forced to implement semantics
values as concrete ref elements. This is very bad, a kind of
conceptual distortion (the author
On Tue, 14 Dec 2010 10:13:03 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
On Tuesday, December 14, 2010 09:48:14 spir wrote:
Hello,
Am I the only one who gets, as only kind of runtime errors, spectacularly
helpful messages like:
int f () {return 0;}
void main
On Tue, 14 Dec 2010 13:44:27 -0500
Jesse Phillips jessekphillip...@gmail.com wrote:
spir Wrote:
Hello,
Am I the only one who gets, as only kind of runtime errors, spectacularly
helpful messages like:
int f () {return 0;}
void main () {
assert (f() == 1);
}
==
s
On Wed, 15 Dec 2010 11:54:28 -0500
Jesse Phillips jessekphillip...@gmail.com wrote:
spir Wrote:
For the following prog, I get:
int element(int[] elements, uint i) {return elements[i];}
void main () {
int[] elements = [3,2,1];
auto e = elements[9];
}
s...@o:~/prog/d
On Tue, 14 Dec 2010 01:43:11 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
I'm also a bit more of a
fan of C++0x concepts than those contraints shown in the slides. I
haven't really thought how it all would work out, but if the atmosphere
was more ambitious to this
On Tue, 14 Dec 2010 00:49:10 -0800
Jonathan M Davis jmdavisp...@gmx.com wrote:
It could definitely serve a purpose if _all_ of the possible template
specializations fail. Presumably, you intend _one_ of them to work. But that
_does_ mean that you get error messages for a number of different
Hello,
Had a nice time degugging an issue after having added an input range interface
to a (big) struct type. Finally managed to deduce the problem happens when
writing out an element of the struct type. This introduced an infinite loop
ending in segfault. Found it weird because the struct's
On Tue, 14 Dec 2010 05:15:05 -0500
bearophile bearophileh...@lycos.com wrote:
Magic constants have issues - be they strings, integrals, or doubles. I
have trouble thinking that complex literals are somehow exempt.
I partially agree. They need to be used with care (and defined only once
On Tue, 14 Dec 2010 11:08:04 -0500
Steven Schveighoffer schvei...@yahoo.com wrote:
Having written a few of these functions with template constraints, I
wondered if there was ever any discussion/agreement on reducing verbosity
when specializing template constraints?
For instance, if you
On Tue, 14 Dec 2010 14:15:20 + (UTC)
Lars T. Kyllingstad pub...@kyllingen.nospamnet wrote:
On Tue, 14 Dec 2010 09:09:33 +0100, spir wrote:
Hello,
It seems impossible to define a random-access range (opIndex + length)
alone. In fact, I cannot have it used by the language. Am I
Hello,
Am I the only one who gets, as only kind of runtime errors, spectacularly
helpful messages like:
int f () {return 0;}
void main () {
assert (f() == 1);
}
==
s...@o:~/prog/d/Text$ ./__trials__
core.exception.asserter...@__trials__(44): Assertion failure
On Mon, 13 Dec 2010 11:50:39 +0100
Stephan Soller stephan.sol...@helionweb.de wrote:
But I do not see in what Ruby-like syntax and point of view are clearer;
actally, I find D far more readable.
And even less what this would bring to D. This is interesting in highly
reflexive languages;
On Mon, 13 Dec 2010 12:12:27 -0500
Nick Sabalausky a...@a.a wrote:
The ability the get a string representation of the argument passd by the
caller would definitely be a great thing to have. Although I think it would
be better placed in __traits or the proposed magic meta namespace, etc.
On Mon, 13 Dec 2010 10:11:15 -0500
Jeff Nowakowski j...@dilacero.org wrote:
Ruby is also one of the slowest languages around, and I'm sure some of
that is due to the freedom it gives you, freedom being what the
speaker calls no static typing and monkey patching.
I wonder why there are so
On Mon, 13 Dec 2010 09:49:50 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
By the way, I couldn't stop cringing at the distasteful, male-centric
sexual jokes that the talk is peppered with. Wonder if there was any
woman in the audience, and how she might have felt. And this
Hello,
I have a strange bug with an input range interface. Initially, I had a (rather
big) struct called Text with loads of working unittests. When adding a range
interface, noting worked anymore, any test ran into an infinite loop (the
terminal writes pages of '[') ending with segfault.
On Sun, 12 Dec 2010 20:43:12 -0500
Andrej M. n...@none.com wrote:
I can't seem to find an easy remove method in std.algorithm that takes an
object and a range (an array in this case) and removes any matches from the
range. I'm using this snippet for now:
private DrawingElement[] elements;
On Mon, 13 Dec 2010 17:37:19 +0300
Nick Voronin elfy...@gmail.com wrote:
On Mon, 13 Dec 2010 11:24:48 +0300, spir denis.s...@gmail.com wrote:
I have a strange bug with an input range interface. Initially, I had a
(rather big) struct called Text with loads of working unittests. When
On Mon, 13 Dec 2010 09:47:39 -0500
Steven Schveighoffer schvei...@yahoo.com wrote:
What's wrong with using opApply? You should be able to define both range
primitives and opApply and opApply will be used when foreach is used, and
the range primitives will be used by things like
On Sun, 12 Dec 2010 04:00:36 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
So likely, idup on an empty string returns an array with null ptr and
0 length, while is 'allocated' in the data segment, and thus given a
ptr value.
.dup .idup should not change a string's truth value. For
Hello,
After the thread on String to boolean inconsistency, here is a little
comparison. I think it speaks by itself.
unittest {
auto form = %s %s %s %s %s %s;
int[] a0;
int[] a1 = [];
writefln(form,
a0?true:false, a1?true:false,
a0 == null, a1
On Sun, 12 Dec 2010 16:29:29 + (UTC)
Adam D. Ruppe destructiona...@gmail.com wrote:
so wrote:
Am i alone thinking D one better here?
No, I find foreach to be significantly better than the ruby
blocks too. I recently argued on the gentoo forums that
they are virtually equivalent too:
On Sun, 12 Dec 2010 12:23:03 -0600
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
Going now
back to D, we can imagine the following lowering:
fun (a, b ; c) stmt
=
fun(c, (a, b) { stmt })
It seems to me that lowering is analog to redefine shallow syntax (in fact,
Hello,
Test case:
struct S {
int[] ints;
int opDollar () {return this.ints.length;}
int opIndex (int i) {return this.ints[i];}
int[] opSlice (int i, int j) {return this.ints[i..j];}
}
unittest {
S s = S([3,2,1]);
// _link_ error on each line:
// Error: undefined
On Sun, 12 Dec 2010 20:47:04 +0100
spir denis.s...@gmail.com wrote:
Hello,
Had a nice time figuring out how to let opApply allow index iteration like:
foreach (i, x ; collection) {}
Finally managed to do it adding 'i' everywhere:
struct S1 {
private int[] elements = [];
int
On Sun, 12 Dec 2010 21:15:00 +0100
Simen kjaeraas simen.kja...@gmail.com wrote:
The trick to ranges is that they modify themselves. For a simple array
wrapper
range this may be a way:
struct wrapper( T ) {
T[] data;
void popFront( ) {
data = data[1..$];
}
On Fri, 10 Dec 2010 21:25:49 -0500
Michel Fortin michel.for...@michelf.com wrote:
On 2010-12-10 17:12:16 -0500, Don nos...@nospam.com said:
Steven Schveighoffer wrote:
To summarize for those looking for the C++ behavior, the equivalent would
be:
void foo(auto ref const Widget)
On Fri, 10 Dec 2010 18:28:08 -0800
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:
It's sort of ironic. Tu viens d'implementing yet another type
constructor yourself!
The need for yet another one signifie sûrement (probably means) their semantics
(in the human sense) are wrongly
On Fri, 10 Dec 2010 20:31:38 -0500
Adam D. Ruppe destructiona...@gmail.com wrote:
On Sat, Dec 11, 2010 at 01:26:01AM +, Ary Borenszweig wrote:
http://vimeo.com/17420638
Is that a full hour of a guy preaching to the choir...
Got a summary?
with ease) and stop caring about being
901 - 1000 of 1219 matches
Mail list logo