Re: containers, iteration, and removal

2012-08-27 Thread Ellery Newcomer
On 08/24/2012 12:23 PM, JN wrote: I feel kinda stupid here, what's wrong with C++ remove_if ( http://www.cplusplus.com/reference/algorithm/remove_if/ )? you mean something like c.erase(remove_if(c.begin(), c.end(), predicate), c.end()) ? That actually is the sort of thing one could

Re: containers, iteration, and removal

2012-08-27 Thread Ellery Newcomer
On 08/27/2012 12:46 PM, Ellery Newcomer wrote: On 08/24/2012 12:23 PM, JN wrote: I feel kinda stupid here, what's wrong with C++ remove_if ( http://www.cplusplus.com/reference/algorithm/remove_if/ )? you mean something like c.erase(remove_if(c.begin(), c.end(), predicate), c.end

Re: how to get fully qualified name of a template function (if possible at CT)

2012-08-27 Thread Ellery Newcomer
On 08/24/2012 11:16 PM, timotheecour wrote: how to get fully qualified name of a template function? In the code below I want to get util.mod.mymethod!(double) I tried everything (see below) to no avail, it just returns mymethod; The closest I get is demangle(mangledName!(fun)), which shouldn't

celerid and cygwin

2012-08-25 Thread Ellery Newcomer
I almost have celerid building extension modules with dmd under cygwin. The issue now is linking to python. With normal windows, it's easy enough to convert libs/pythonXY.lib to OMF. With cygwin, we have /usr/lib/pythonX.Y/config/pythonX.Y.dll.a. Don't know what to do with that. My

Re: call member function alias

2012-08-24 Thread Ellery Newcomer
On 08/23/2012 11:47 PM, Jacob Carlborg wrote: How about this: import std.stdio; class Foo { auto forward (alias fn, Args...) (Args args) { return fn(args); } void bar (int a = 3) { writeln(bar , a); } } auto call (alias fn, T, Args...) (T t,

abnormal program termination

2012-08-24 Thread Ellery Newcomer
I am running into an ICE on windows - Assertion Failure on such-and-such line in mtype.c - and I am trying to get a test command for to reduce it with the redoubtable dustmite. Normally, 'abnormal program termination' is printed to the console; however if I try to redirect stderr for greppage

call member function alias

2012-08-23 Thread Ellery Newcomer
if I have a member function alias and corresponding object and arguments, is there any way to turn them into a member function call? e.g. class X{ void a(); } auto profit(alias fn, T, Args...)(T t, Args args) { ??? } profit!(X.fn, X)(x); Constraints are: 1) must conserve ability to omit

function pointer and default argument

2012-08-22 Thread Ellery Newcomer
hey. is this valid code? void func1(int i, double j = 1.0) { } void main() { auto fn = func1; func1(1); //dmd: ok fn(1); // dmd: not ok }

Re: function pointer and default argument

2012-08-22 Thread Ellery Newcomer
On 08/22/2012 12:03 PM, Ali Çehreli wrote: On 08/22/2012 11:51 AM, Ellery Newcomer wrote: hey. is this valid code? void func1(int i, double j = 1.0) { } void main() { auto fn = func1; func1(1); //dmd: ok fn(1); // dmd: not ok } The type of the function pointer does

Re: where is parameterNames?

2012-08-19 Thread Ellery Newcomer
On 08/15/2012 09:46 AM, David Nadlinger wrote: Related: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L510 David That should work nicely. Why does it not show up on dlang.org?

Re: prevent multiple calls to rt_term

2012-08-13 Thread Ellery Newcomer
On 08/13/2012 01:19 PM, Sean Kelly wrote: Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime really terminates. is it valid to call rt_init more than once?

Re: prevent multiple calls to rt_term

2012-08-13 Thread Ellery Newcomer
On 08/13/2012 03:37 PM, Sean Kelly wrote: On Aug 13, 2012, at 2:07 PM, Ellery Newcomer ellery-newco...@utulsa.edu wrote: On 08/13/2012 01:19 PM, Sean Kelly wrote: Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime

template - aliasing a member function

2012-08-08 Thread Ellery Newcomer
say I have template T(alias fn) { } class Foo { int i(); void i(int); } alias T!(Foo.i) Biz; Is there a way to get a handle to both of the overloads of Foo.i inside T? Actually, all I really need for that is to get 'Foo.i' out of fn. mangleof looks promising..

Re: template - aliasing a member function

2012-08-08 Thread Ellery Newcomer
On 08/08/2012 04:21 PM, Ellery Newcomer wrote: mangleof looks promising.. .. or maybe not. wtf? template Z(string s) { pragma(msg, fn.mangleof 2: ~ s); } struct S(alias fn, string prop) { pragma(msg, fn.mangleof 1: ~ fn.mangleof); alias Z!(fn.mangleof) F; } class Foo

containers, iteration, and removal

2012-08-01 Thread Ellery Newcomer
Hello. Today I was thinking about Java. Specifically, java.util.Iterator and the pattern while(iter.hasNext()) { Object item = iter.next(); if(predicate(item)) { iter.remove(); } } You can do this in Java. Easily. You can also do this in C++ with

Re: sorting failed error

2012-07-30 Thread Ellery Newcomer
On 07/30/2012 05:36 AM, maarten van damme wrote: I have no idea what is wrong with my code and the error is not very informative. Does anyone have any idea as to what the problem could be? Congratulations, it looks like you've hit a compiler bug.

Re: Getting a range over a const Container

2012-07-20 Thread Ellery Newcomer
On 07/19/2012 06:09 PM, Ellery Newcomer wrote: On 07/19/2012 02:51 AM, Artur Skawina wrote: Range!Node opSlice() { return Range!Node(first); } Range!(const Node) opSlice() const { return Range!(const Node)(first); } it looks like you could almost merge these two into one

Re: Getting a range over a const Container

2012-07-19 Thread Ellery Newcomer
On 07/19/2012 02:51 AM, Artur Skawina wrote: Range!Node opSlice() { return Range!Node(first); } Range!(const Node) opSlice() const { return Range!(const Node)(first); } anyone mind cluing me in on why this is possible?

Re: Getting a range over a const Container

2012-07-19 Thread Ellery Newcomer
On 07/19/2012 06:18 PM, Ali Çehreli wrote: Now the output is different: non-const foo called on a const foo called on b Ali cool beans, thanks.

Re: using GC needs particular skills?

2012-07-15 Thread Ellery Newcomer
On 07/15/2012 09:01 AM, Alexandr Druzhinin wrote: 15.07.2012 22:56, Alexandr Druzhinin пишет: 15.07.2012 22:33, Alex Rønne Petersen пишет: test case: class A { } __gshared A a; void main(string[] args) { a = new A; } every time after finishing application I get

Re: aa.remove in a destructor

2012-06-28 Thread Ellery Newcomer
On 06/26/2012 12:41 PM, Steven Schveighoffer wrote: I want to red flag this code for another reason. You must *never* access GC-allocated references in a destructor, to do so will make the program crash randomly. The docs should be so assertive (not that I read them or anything). The

Re: aa.remove in a destructor

2012-06-26 Thread Ellery Newcomer
On 06/24/2012 01:56 PM, Ellery Newcomer wrote: Come to think of it, though, shouldn't the standard library provide an aa implementation that doesn't rely on the gc? ah, screw it, I'll just write my own.

Re: aa.remove in a destructor

2012-06-24 Thread Ellery Newcomer
On 06/24/2012 02:53 AM, Dmitry Olshansky wrote: I think no, as any with operation involving GC. For instance while you are removing elements table may decide to rehash itself and that means it may trigger allocation. okay, it looks like my [inherited] code is using aa's to map D objects to

aa.remove in a destructor

2012-06-23 Thread Ellery Newcomer
this code: class X{ string[string] s; this() { s[s] = S; } ~this() { s.remove(s); } } void main() { X x = new X(); } produces this: core.exception.InvalidMemoryOperationError because the aa is calling gc_free during a collection, apparently. Should I

Re: D in your browser? possible?

2012-06-17 Thread Ellery Newcomer
On 06/17/2012 11:38 AM, Damian wrote: I've noticed a few languages are adopting this, for example Haskell: http://tryhaskell.org Go: http://play.golang.org those sure look a lot more polished than ideone.com

compile time regex

2012-06-16 Thread Ellery Newcomer
There is a ctRegex; is there a compile time equivalent for match?

optlink

2012-05-13 Thread Ellery Newcomer
Hey, a while back I was messing around with some winapi calls in D, and I had occasion to want to link to crypt32.dll, but dmd doesn't seem to ship with a crypt32.lib. I tried downloading the platform sdk or whatever the thing is called, but, um... dmd ssl_client.d C:\Program

Re: Shared library in D on Linux

2012-04-10 Thread Ellery Newcomer
On 04/10/2012 01:31 AM, Jacob Carlborg wrote: The module info (contains the module constructors) need to be setup differently when linking as a shared library. The odd thing is, when you skip _init and _fini and just do rt_init(); writeln(stuff); rt_term(); it doesn't segfault

Re: Shared library in D on Linux

2012-04-10 Thread Ellery Newcomer
On 04/10/2012 12:04 PM, Jacob Carlborg wrote: The odd thing is, when you skip _init and _fini and just do rt_init(); writeln(stuff); rt_term(); it doesn't segfault Are the module constructors run? they would have to be for writeln to not segfault

Re: Shared library in D on Linux

2012-04-10 Thread Ellery Newcomer
On 04/10/2012 12:21 PM, Jacob Carlborg wrote: On 2012-04-10 19:12, Ellery Newcomer wrote: they would have to be for writeln to not segfault Ok, I see. tried using __attribute__((constructor)) instead of _init. If I'm getting this line to fail in rt.minfo.sortCtorsImpl

Re: MD5, SHA1, SHA256, CRC32

2012-04-10 Thread Ellery Newcomer
you might see if the tango d2 port impls are working https://github.com/SiegeLord/Tango-D2/tree/d2port/tango/util/digest On 04/10/2012 04:25 AM, Russel Winder wrote: I'm in need of calculating these numbers as part of a program. Java, Python, Go, all provide these algorithms out of the box.

Re: Shared library in D on Linux

2012-04-09 Thread Ellery Newcomer
Well, if you're really hankering for a shared lib, try ldc. I have gotten it to compile working shared libs in the past. On 04/09/2012 01:24 AM, Timo Westkämper timo.westkam...@gmail.com wrote: On Sunday, 8 April 2012 at 17:59:28 UTC, Timo Westkämper wrote: Does someone know why the lib (.a)

Re: Shared library in D on Linux

2012-04-09 Thread Ellery Newcomer
On 04/09/2012 03:31 PM, Timo Westkämper timo.westkam...@gmail.com wrote: For some reasons, the _init and _fini parts don't yet work properly. what's wrong with them? if it is a link problem, use gcc -nostartfiles. Well, I'm doing that, and it compiles and rt_init is called, but doesn't

Re: Shared library in D on Linux

2012-04-08 Thread Ellery Newcomer
On 04/08/2012 03:45 AM, Timo Westkämper timo.westkam...@gmail.com wrote: extern(C) { void gc_init(); void gc_term(); void _init() { gc_init(); } void _fini() { gc_term(); } } I think you want rt_init and rt_term here.

Re: rpm spec for rhel and fedora

2012-04-05 Thread Ellery Newcomer
bash completion? where does this come from? On 04/05/2012 01:27 PM, lzzll wrote: Hey, I created a new rpm spec. I already test it on rhel6 32bit and 64bit and works well both.

Re: Fortran DLL and D

2012-03-14 Thread Ellery Newcomer
On 03/13/2012 05:15 PM, Michael wrote: Hi everyone) dmd 2.058 os: win 7 64 bit fortran compilers: gfortran, ftn95 Here's apples to oranges, since I'm on linux 64 bit, but with your code and this: pragma(lib, flib); extern(C) void fsu_(int*i); void main(){ int i = 1; fsu_(i); }

Re: Remarks on std.container

2012-03-08 Thread Ellery Newcomer
On 03/08/2012 03:21 AM, Matthias Walter wrote: Hi, I wanted to have a binary heap where I can update entries and restore the heap structure. shameless plug I totally built this functionality in to multi_index's red black tree, hash table, and heap indeces.

Re: 0 negative loop condition bug or misunderstanding on my part

2012-03-07 Thread Ellery Newcomer
On 03/07/2012 12:23 AM, Ali Çehreli wrote: There are probably hundreds of discussions about that over the years on many different language newsgroups and forums. :) There is no clear winner: Both sides of the arguments seem to have good points. Ali know any good ones off the top of your

Re: multi_index

2012-03-05 Thread Ellery Newcomer
On 03/05/2012 07:05 AM, Andrei Alexandrescu wrote: Great! I meant for a long time to suggest Steve Schveighoffer to accept a variadic number of predicates for the red-black tree. This is even more general (nevertheless I still think it would be great if RedBlackTree accepted multiple

Re: Is empty array null?

2012-02-28 Thread Ellery Newcomer
On 02/28/2012 05:25 AM, Mikael Lindsten wrote: This means that I can doif (someString.length) { ... }without worrying about the null case (?). That's great! Correct

Re: Is empty array null?

2012-02-27 Thread Ellery Newcomer
On 02/27/2012 03:12 PM, Pedro Lacerda wrote: Ouch, I just found http://d.puremagic.com/issues/show_bug.cgi?id=3889 So how would I differ from an empty array and a null value? Pedro Lacerda If you know your type is an array, just use a.length to test if the array is empty. The concept of

Re: Is empty array null?

2012-02-27 Thread Ellery Newcomer
On 02/27/2012 03:17 PM, Justin Whear wrote: null makes sense to me. If the length is null, where can the ptr member point to other than null? In the case of empty array slices, ptr can point to anywhere. But then, empty array slices aren't null.

Re: PyD

2012-02-24 Thread Ellery Newcomer
On 02/23/2012 11:40 PM, Ellery Newcomer wrote: it seems not to be compiling with the 2.058 front end 3 (4 but for a segfault during shutdown) out of the 5 examples compile with 2.058 and run!

Re: SONAME and D

2012-02-24 Thread Ellery Newcomer
On 02/24/2012 06:27 AM, Jordi Sayol wrote: It compiles to 32-bit but fails for 64-bit, maybe due to compiled libphobos2 (64-bit) without -fPIC argument? What? -shared works with 32-bit? Holy crap, it does! this is awesome! maybe make a bug report for 64 bit?

deh_end

2012-02-24 Thread Ellery Newcomer
So I'm all trying out this hot new shared switch, and it works just dandy for -m32 when d has the main function. But now I want to be able to call my shared lib from C. my little shared lib, tup.d: import std.stdio; extern(C) void xyz(int i){ writeln(i); } compiled like so: dmd

Re: PyD

2012-02-23 Thread Ellery Newcomer
Well, I can't make any promises, but you can try this: https://bitbucket.org/ariovistus/pyd it seems not to be compiling with the 2.058 front end, but I think it should with the 2.057 front end and ldc. python headers are updated to support 2.5 thru 2.7, though I only tested with 2.7 good

Re: PyD

2012-02-23 Thread Ellery Newcomer
On 02/23/2012 11:40 PM, Ellery Newcomer wrote: Well, I can't make any promises, but you can try this: https://bitbucket.org/ariovistus/pyd it seems not to be compiling with the 2.058 front end, but I think it should with the 2.057 front end and ldc. crumb, I take that back Anyone know why

fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
looking for core.stuff I would have thought they would be in ldc-druntime-devel, but they don't seem to be, and I can't find them elsewhere

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
On 02/23/2012 05:08 PM, bioinfornatics wrote: Le jeudi 23 février 2012 à 16:29 -0600, Ellery Newcomer a écrit : looking for core.stuff I would have thought they would be in ldc-druntime-devel, but they don't seem to be, and I can't find them elsewhere in ldc-druntime-devel see above command

Re: mixin template FAIL

2012-02-23 Thread Ellery Newcomer
Thanks for your reply. You're right about the statement. But I still think something's wrong. For example, even this program produces the errors: import std.stdio; mixin template helpMe() { writeln(Satisfying!); } does it do that if you replace the statement with a declaration? like this:

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
grumph. is it not possible to fix the packages in repo? On 02/23/2012 05:17 PM, bioinfornatics wrote: get latest ldc build here: http://koji.fedoraproject.org/koji/buildinfo?buildID=299767 install it with yum install after dowloading these rpm

Re: PyD abandoned?

2012-02-22 Thread Ellery Newcomer
I think PyD is all there is. But it seems like someone around here (other than me) was trying to bring it back to life. Can't remember who or if I was dreaming, though. When I tried to do this, I found I had problems building shared libraries for any compiler but ldc (thus no windows

Re: mixin template FAIL

2012-02-21 Thread Ellery Newcomer
On 02/21/2012 01:53 PM, Ali Çehreli wrote: According to the docs, template mixins can have only declarations but helpMe above has a statement. http://dlang.org/template-mixin.html Ali come to think of it, I've occasionally wished for statement mixins. This would make a good enhancement

RedBlackTree.lowerBound

2012-02-19 Thread Ellery Newcomer
Is it just me or are lowerBound and upperBound really unintuitively named? From DDOC: c.lowerBound(v) Returns a range of all elements strictly less than v c.upperBound(v) Returns a range of all elements strictly greater than v. So c.lowerBound(v) will return a range for which v is the ..

multi_index

2012-02-17 Thread Ellery Newcomer
Felicitations. Last summer I wrote a port of boost::multi_index when I had some down time (I haven't had too much since until now). It is here: https://bitbucket.org/ariovistus/multi_index/ some cursory ddoc here: http://ariovistus.bitbucket.org/multi_index.html It is functional, if not

Re: warning: size of symbol changed

2012-02-16 Thread Ellery Newcomer
On 02/16/2012 01:32 AM, Jacob Carlborg wrote: On 2012-02-16 03:35, Ellery Newcomer wrote: has anyone else gotten warnings of the nature /usr/bin/ld: Warning: size of symbol `{875charlongsymbol}' changed from 107 in multi_index.o to 99 in multi_index.o Sounds like you should do a clean build

warning: size of symbol changed

2012-02-15 Thread Ellery Newcomer
has anyone else gotten warnings of the nature /usr/bin/ld: Warning: size of symbol `{875charlongsymbol}' changed from 107 in multi_index.o to 99 in multi_index.o

Re: warning: size of symbol changed

2012-02-15 Thread Ellery Newcomer
On 02/15/2012 10:03 PM, Ali Çehreli wrote: On 02/15/2012 06:35 PM, Ellery Newcomer wrote: has anyone else gotten warnings of the nature /usr/bin/ld: Warning: size of symbol `{875charlongsymbol}' changed from 107 in multi_index.o to 99 in multi_index.o This can happen if there are two object

Re: dmd thrashes fedora

2012-02-12 Thread Ellery Newcomer
On 02/12/2012 08:34 AM, Timon Gehr wrote: It is a bug in your code: - ForEachIndex!(N+1, L).result; + ForEachIndex!(N+1, L[1..$]).result; The diagnostic DMD spits out is quite bad. Wow. In my defense, the original code is right; apparently dustmite did this to the reduced case. I know I

Re: Octal-like integer literals

2012-02-11 Thread Ellery Newcomer
OT: http://d.puremagic.com/issues/show_bug.cgi?id=5132 On 02/11/2012 10:06 AM, Daniel Murphy wrote: interpreted differently is just errors waiting to happen.

Re: shifting array slices

2012-02-11 Thread Ellery Newcomer
http://d.puremagic.com/issues/show_bug.cgi?id=7484 On 02/11/2012 12:09 PM, Ellery Newcomer wrote: I'm pretty sure this used to work: import std.algorithm; int[] ra; copy(ra[5 .. 10], ra[4 .. 9]); and would correctly shift the range [5 .. 10] down one (unlike ra[4 .. 9] = ra[5 .. 10], which

dmd thrashes fedora

2012-02-10 Thread Ellery Newcomer
when I run dmd -gc -oftopo topo.d multi_index.d replace.d on the contents of http://personal.utulsa.edu/~ellery-newcomer/bad.zip in fedora 16 x86_64 with dmd 2.057 64 bit dmd starts thrashing like there is no tomorrow and generally locks up my entire system. Can anyone confirm

toString multiple overrides

2012-02-10 Thread Ellery Newcomer
dmd 2.057 Two mixin templates, each define toString, mix them in to your class and .. Error: function test.X.T2!().toString multiple overrides of same function So this behavior is new, but is it sensical? Sample code: mixin template T1(){ string toString(){ return 1; } } mixin

Re: for loop

2012-01-23 Thread Ellery Newcomer
On 01/22/2012 11:37 AM, Zachary Lund wrote: This is an ugly solution (and I'm not 100% sure it's valid D) but: /+/ void main() { { short y = 0; int x = 0; for (; x 10; ++x, ++y) { } } } /+/ raise you. void main(){ for ({int

Re: Fedora 17 will include support for the D programming language

2011-12-13 Thread Ellery Newcomer
On 12/13/2011 05:47 PM, Andrei Alexandrescu wrote: http://www.reddit.com/r/programming/comments/nbndg/fedora_17_will_include_support_for_the_d/ Andrei it would be nice if there were d bindings to libraries in fedora

Re: ldc new feature

2011-12-08 Thread Ellery Newcomer
On 12/08/2011 06:52 AM, bioinfornatics wrote: Dear, I am pleased to announce the new features. LDC is now offering the flag-shared-lib and libraries to create static and dynamic. The latest version of ldc works with llvm 3.0 and uses dmdfe 2056. The project ldc sees increased the number of

Re: shared lib

2011-11-15 Thread Ellery Newcomer
On 11/15/2011 01:19 AM, Jacob Carlborg wrote: On 2011-11-14 19:05, Ellery Newcomer wrote: core.runtime.Runtime.initialize cool Not sure if that will initialize everything properly. Have a look in rt.dmain2.main and make sure you do that same initialize the runtime. yep, found that file

Re: shared lib

2011-11-14 Thread Ellery Newcomer
On 11/14/2011 10:31 AM, Jerry wrote: The error looks like phobos wasn't build with position-independent code. Jerry you know, I think you're right. I even wrote out the names of all those *.a files when I was building a gdc rpm. *slaps head* well, it doesn't matter now. I've gotten ldc to

shared lib

2011-11-10 Thread Ellery Newcomer
trying to build a .so file (actually, trying to resuscitate pyd) with gdc. celerid is spitting out gdc -fPIC -nostartfiles -shared -fdebug {lots of object files plus some link directives} which is spitting out /usr/bin/ld: /usr/lib64/libgphobos2.a(object_.o): relocation R_X86_64_32S against

odd use of preprocessor

2011-11-06 Thread Ellery Newcomer
poking about in elfutils headers, I've come across the following idiom several times /* Error values. */ enum { DW_TAG_invalid = 0 #define DW_TAG_invalid DW_TAG_invalid }; anyone know if anything strange is going on here that would prevent trivial conversion to d?

Re: odd use of preprocessor

2011-11-06 Thread Ellery Newcomer
On 11/06/2011 01:50 PM, Alex Rønne Petersen wrote: On 06-11-2011 20:43, Ellery Newcomer wrote: poking about in elfutils headers, I've come across the following idiom several times /* Error values. */ enum { DW_TAG_invalid = 0 #define DW_TAG_invalid DW_TAG_invalid

Re: Sorting algorithm

2011-10-08 Thread Ellery Newcomer
it'd be nice if there were some convenience templates somewhere for converting a lt function to le,gt,ge, etc On 10/08/2011 10:04 AM, Andrei Alexandrescu wrote: I don't understand. Say all you have is . Then you can do everything: a = b is !(b a) a b is b a

Re: Sorting algorithm

2011-10-07 Thread Ellery Newcomer
-inline -release, sources are http://personal.utulsa.edu/~ellery-newcomer/timsort.d http://personal.utulsa.edu/~ellery-newcomer/xinokSort.d Nice job, Xinok. anyone want to try to optimize my timsort? :)

Re: Sorting algorithm

2011-10-07 Thread Ellery Newcomer
On 10/07/2011 01:20 PM, Andrei Alexandrescu wrote: Also, which version of D are you using? I'm seeing that std.algorithm.sort (introSort) performs quite badly; for example, it's twice as slow on shuffled data against quickSort, and it also deals badly with already sorted data. Generally it

Re: int C function

2011-10-01 Thread Ellery Newcomer
On 10/01/2011 08:33 AM, Andrej Mitrovic wrote: On 10/1/11, Ellery Newcomer ellery-newco...@utulsa.edu wrote: On 09/30/2011 08:20 PM, Andrej Mitrovic wrote: I think this is a side-effect of the new function pointer fixes, where you now can't implicitly convert an extern(C) function to an extern

int C function

2011-09-30 Thread Ellery Newcomer
weird error. anyone know what's going on? [ellery@localhost d]$ cat test.d extern(C) int puts(const char *s); class X{ @property void tt(int function(const char *) xz){ } } void main(){ X x = new X(); x.tt = puts; } [ellery@localhost d]$ dmd test test.d(8): Error: function

Re: int C function

2011-09-30 Thread Ellery Newcomer
On 09/30/2011 08:20 PM, Andrej Mitrovic wrote: I think this is a side-effect of the new function pointer fixes, where you now can't implicitly convert an extern(C) function to an extern(D) function by accident (and that's a good thing). But the problem is, you can't define a function with a

Re: int C function

2011-09-30 Thread Ellery Newcomer
On 09/30/2011 08:20 PM, Andrej Mitrovic wrote: I think this is a side-effect of the new function pointer fixes, where you now can't implicitly convert an extern(C) function to an extern(D) function by accident (and that's a good thing). But the problem is, you can't define a function with a

Re: Why is std.string.format a c-style variadic function?

2011-09-26 Thread Ellery Newcomer
On 09/26/2011 07:42 AM, Andrej Mitrovic wrote: On 9/26/11, Jacob Carlborg d...@me.com wrote: std.string.format is using a D-style variadic parameter list. The compiler disagrees with you: D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\string.d(2432): Error: function std.string.format

Re: How do formally you call the 'in' operator?

2011-09-24 Thread Ellery Newcomer
On 09/24/2011 01:18 PM, Andrej Mitrovic wrote: Information about overloading opIn and opIn_r is missing from the docs, so I'm writing that section. But I don't know what is the formal name of this operator so I can put it in the title. Maybe I should just name the title Overloading the In

Re: Why this simple binaryHeap program does not compile?

2011-09-22 Thread Ellery Newcomer
On 09/22/2011 06:10 AM, Cheng Wei wrote: Is this a bug or I use the binary heap wrongly? Thanks a lot! Looks like a bug in Array. emplace doesn't accept a pointer to a chunk for class types. Report that puppy!

Re: attribute decl in version decl

2011-09-19 Thread Ellery Newcomer
On 09/18/2011 01:02 PM, Timon Gehr wrote: If you are asking, if the D compiler is wrong here: No, it is by design, you can check with the D grammar. Nah, just confirming that failure to apply the externs is a bug.

Re: attribute decl in version decl

2011-09-19 Thread Ellery Newcomer
On 09/18/2011 04:09 PM, Trass3r wrote: Am 18.09.2011, 18:55 Uhr, schrieb Ellery Newcomer ellery-newco...@utulsa.edu: Just came across some old D code that does this: version(linux){ extern(C): } Hundreds of OpenGL decls in dmd 2.055, the extern(C) is not being applied

Re: attribute decl in version decl

2011-09-19 Thread Ellery Newcomer
On 09/18/2011 11:04 PM, Daniel Murphy wrote: Ellery Newcomer ellery-newco...@utulsa.edu wrote in message news:j557r6$vgt$1...@digitalmars.com... Just came across some old D code that does this: version(linux){ extern(C): } Are the prototypes extern(Windows) when not on linux, by any

Re: attribute decl in version decl

2011-09-19 Thread Ellery Newcomer
On 09/19/2011 08:59 AM, Timon Gehr wrote: You could use the C preprocessor ;). Or this, that does the same thing: version(V1) private enum _v1=true; else private enum _v1=false; mixin((_v1?extern(System)::extern(C):)~q{ // all declarations that should be affected. }); code golf or

Re: Signed-unsigned comparisons in Phobos

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 04:06 PM, Don wrote: No, it was specifically disallowed. Version D 2.037 Dec 3, 2009 New/Changed Features No more comma operators allowed between [ ]. I think that was for type declarations, not index expressions. you can still do this: import std.stdio; struct X{ void

to invalidate a range

2011-08-12 Thread Ellery Newcomer
in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate a range? my assumption is it means causing e.g. front or popFront to fail when empty says they should succeed or vice versa.

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:13 PM, bearophile wrote: Ellery Newcomer: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate a range? Generally modifying a collection while you iterate on it causes troubles

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:29 PM, Steven Schveighoffer wrote: On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer ellery-newco...@utulsa.edu wrote: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:54 PM, Jonathan M Davis wrote: In the case of container that uses nodes - such as a linked list - because you can add and remove elements without affecting other elements, iterators and ranges don't tend to get invalidated as easily. As long as you don't remove the element (or

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 05:51 PM, Jonathan M Davis wrote: An implementation can guarantee it as long as your range doesn't directly point to an element being removed (i.e. as long as the element isn't on the ends - or maybe one past the end, depending on the implementation). But _no_ container can

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 06:34 PM, Jonathan M Davis wrote: Forgive my being dense, but where is this 'as long as' coming from? If your range only points to ends in e.g. a linked list, how is it supposed to retrieve elements in the middle? I'm having a hard time visualizing a range over a node based

Re: Next in Review Queue: The New std.path

2011-07-18 Thread Ellery Newcomer
Looks nice. a thought: alternate data streams are fringe and probably don't warrant support (you might look into them), but windows \\?\ paths probably should be supported in eg joinPath and pathSplitter

Re: Complete D grammar

2011-04-06 Thread Ellery Newcomer
On 03/29/2011 07:53 AM, Bruno Medeiros wrote: On 28/03/2011 18:19, Luca Boasso wrote: You can find an ANTLR grammar for D v1 at http://www.dsource.org/projects/antlrd/browser/toys/v3d/parsed.g (by Ellery Newcomer) I never should have uploaded that file. Indeed, Ellery is (AFAIK) the only

Re: David Simcha's std.parallelism

2011-02-04 Thread Ellery Newcomer
svn ls http://svn.dsource.org/projects/scrapple/trunk/parallelFuture/ works for me On 02/04/2011 11:28 AM, Russel Winder wrote: On Fri, 2011-02-04 at 08:09 -0500, dsimcha wrote: I could move it over to github, though I'll wait to do that until I get a little more comfortable with Git. I had

Re: buffered input

2011-02-04 Thread Ellery Newcomer
On 02/04/2011 11:46 PM, Andrei Alexandrescu wrote: I've had the opportunity today to put some solid hours of thinking into the relationship (better said the relatedness) of what would be called buffered streams and ranges. They have some commonalities and some differences, but it's been

Re: unsigned int in for loops

2011-02-04 Thread Ellery Newcomer
I think this was the impetus for foreach_reverse, or at least it is one place where it is pretty handy. Don't remember what all there is in D1, but in D2 you could do something like foreach_reverse(i; 0u .. 10u){ // iterates over 9,8,7 .. 1,0 } for more complex iterations, I suppose you're

Re: unsigned int in for loops

2011-02-04 Thread Ellery Newcomer
On 02/04/2011 02:31 PM, Jesse Phillips wrote: Ellery Newcomer Wrote: I think this was the impetus for foreach_reverse, or at least it is one place where it is pretty handy. Don't remember what all there is in D1, but in D2 you could do something like foreach_reverse(i; 0u .. 10u){ // iterates

Re: common types + type modifiers

2011-01-30 Thread Ellery Newcomer
On 01/30/2011 09:47 AM, Michel Fortin wrote: On 2011-01-29 20:09:11 -0500, Ellery Newcomer ellery-newco...@utulsa.edu said: trying to wrap my head around shared,const,immutable (not inout yet, though someday I'll need to figure out what it's supposed to do) Currently, dmd doesn't exhibit

Re: pragma(msg,

2011-01-30 Thread Ellery Newcomer
On 01/30/2011 03:47 PM, Philippe Sigaud wrote: On Sun, Jan 30, 2011 at 19:15, Ellery Newcomer ellery-newco...@utulsa.edu wrote: doh. when I did something like enum string s = tct!(int,int); it just took it and didn't complain that it didn't know the value at compile time. I think

<    1   2   3   4   5   6   7   8   >