Re: I can has @nogc and throw Exceptions?

2018-07-19 Thread timotheecour via Digitalmars-d-learn
On Friday, 13 February 2015 at 19:03:10 UTC, Jonathan Marler wrote: This question comes from wanting to be able to throw an exception in code that is @nogc. https://dlang.org/changelog/2.079.0.html#dip1008 ```d void main() @nogc { throw new Exception("I'm @nogc now"); } ```

Re: Possible dmd 2.078 regression ?

2018-01-26 Thread timotheecour via Digitalmars-d-learn
On Friday, 12 January 2018 at 18:51:31 UTC, Basile B. wrote: On Friday, 12 January 2018 at 18:50:10 UTC, Basile B. wrote: On Friday, 12 January 2018 at 17:58:30 UTC, Stefan Koch wrote: On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the

Re: Is it possible to obtain textual representation of an arbitary code?

2018-01-26 Thread timotheecour via Digitalmars-d-learn
On Friday, 26 January 2018 at 11:18:21 UTC, Oleksii Skidan wrote: Hi, I wonder if it's possible to convert D language code into a string at compile time? C/C++ preprocessor has this feature built-in: `#` preprocessing operator allows converting a macro argument into a string constant. See the

Re: Relocatable objects and internal pointers

2018-01-20 Thread timotheecour via Digitalmars-d-learn
On Saturday, 30 January 2016 at 03:13:59 UTC, Matt Elkins wrote: std.typecons.Unique seems to require heap allocation, which makes it a far cry from std::unique_ptr. isn't unique_ptr typically for heap allocation? eg: https://stackoverflow.com/questions/42910711/unique-ptr-heap-and-stack-allo

Re: Understanding how dub works

2017-12-12 Thread timotheecour via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 00:43:31 UTC, rikki cattermole wrote: You don't need to change this and if you think you do, you're wrong :) Except when you need to: https://github.com/dlang/dub/issues/1305 dub build --compiler=ldmd2 overwrites files in ~/.dub written by dub build #1305

Re: Time from timestamp?

2017-04-08 Thread timotheecour via Digitalmars-d-learn
Might I suggest that you simply define an enum for UnixEpoch that's a SysTime. Then you can do whatever you want. ping on this.

Re: The module 'foo' is already defined in 'libmylib.so'

2016-12-09 Thread timotheecour via Digitalmars-d-learn
On Saturday, 10 December 2016 at 02:39:33 UTC, timotheecour wrote: Have a look at what `trace -E d_executable args` and `trace -E c++_executable args` print on startup and grep for dlopen calls and the like. do you mean strace? I have trace on OSX but I'm asking for linux. Looking a

Re: The module 'foo' is already defined in 'libmylib.so'

2016-12-09 Thread timotheecour via Digitalmars-d-learn
Have a look at what `trace -E d_executable args` and `trace -E c++_executable args` print on startup and grep for dlopen calls and the like. do you mean strace? I have trace on OSX but I'm asking for linux.

Re: how to debug exceptions/asserts thrown in module constructors?

2016-11-27 Thread timotheecour via Digitalmars-d-learn
UPDATE: * b Loader.d:123 didn't help either: error: parsing line table prologue at 0x (parsing ended around 0x Breakpoint 1: where = mybinary.temp`D4gtkc6Loader6Linker12_staticDtor3FZv, address = 0x000100315410 (process exited despite breakpoint); dmd's dwarf debug info se

Re: deserialization: creating a class instance without calling constructor

2015-05-25 Thread timotheecour via Digitalmars-d-learn
On Thursday, 21 May 2015 at 19:06:35 UTC, Jacob Carlborg wrote: On 2015-05-21 11:06, Timothee Cour via Digitalmars-d-learn wrote: Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class w

Re: Serialization library with support for circular references?

2015-05-23 Thread timotheecour via Digitalmars-d-learn
On Saturday, 23 May 2015 at 08:01:28 UTC, timotheecour wrote: On Saturday, 10 November 2012 at 22:09:07 UTC, Andrej Mitrovic wrote: On 11/10/12, nixda wrote: You can try vibe.d bson serialization. http://vibed.org/api/vibe.data.bson/serializeToBson It doesn't handle them either. Anyway

Re: Serialization library with support for circular references?

2015-05-23 Thread timotheecour via Digitalmars-d-learn
On Saturday, 10 November 2012 at 22:09:07 UTC, Andrej Mitrovic wrote: On 11/10/12, nixda wrote: You can try vibe.d bson serialization. http://vibed.org/api/vibe.data.bson/serializeToBson It doesn't handle them either. Anyway I've implemented it for msgpack (took a whole of 30 minutes, it's a

Re: 'with(Foo):' not allowed, why?

2014-08-08 Thread timotheecour via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 17:03:23 UTC, Timothee Cour via Digitalmars-d-learn wrote: Is there a reason why 'with(Foo):' is not allowed, and we have to use with(Foo){...} ? It would be more in line with how other scope definitions work (extern(C) etc) ping, anyone?

Re: alias with lambda syntax: alias fun2=a=>fun(a);

2014-06-05 Thread timotheecour via Digitalmars-d-learn
On Thursday, 5 June 2014 at 06:58:50 UTC, Timothee Cour via Digitalmars-d-learn wrote: Is there a way to do this? import std.algorithm; auto fun(T)(T a){return a;} template fun2(T){auto fun2(T a){return fun(a);}}//OK but heavy syntax and cannot be nested inside test() void main(){ //alias

Re: how to iterate over an AA by key-value pair (tuple)?

2014-02-13 Thread timotheecour
On Thursday, 13 February 2014 at 23:56:35 UTC, Timothee Cour wrote: how to iterate over an AA by key-value pair (tuple)? use case: avoid interrupting UFCS chains, eg: foo.generate_aa.byKeyValue.filter!(a=>a[0].isLower).map!(a=>a[1]) ... of course I could roll my own function but I was wondering

Re: how to handle memory ownership when interfacing with C/C++ via internal pointers

2013-10-15 Thread timotheecour
On Thursday, 10 October 2013 at 23:02:29 UTC, Timothee Cour wrote: Short version: I have a struct A* aptr allocated in C/C++ with an internal pointer aptr->ptr (say a double*) I want to store a reference x (say double[]) in D to aptr only through aptr->ptr, not through aptr directly as it's inco

Re: interacting with a process with redirected stdin/stdout/stderr

2013-07-14 Thread timotheecour
On Monday, 15 July 2013 at 03:49:10 UTC, Timothee Cour wrote: I'm trying to interact with a process using std.process and redirected stdin/stdout/stderr. What would be the recommended way? For example: auto pipes=pipeShell("myprocess",Redirect.all); while(true){ pipes.stdin.rawWrite(some_

Re: best way to handle UFCS with ambiguous names: using std.typetuple.Alias!

2013-06-11 Thread timotheecour
On Monday, 10 June 2013 at 08:13:42 UTC, John Colvin wrote: On Monday, 10 June 2013 at 02:02:09 UTC, Timothee Cour wrote: UFCS chains are problematic when a symbol is ambiguous (eg after import std.stdio:write;import std.file:write); I previously suggested to add the syntax 'arg1.(std.file.wri

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread timotheecour
something like this, which we should have in std.regex: string escapeRegex(string a){ import std.string; enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+': `\+`, '?': `\?`, '(': `\(`, ')': `\)`]; return translate(a, transTable); } string escapeRegexReplace(string a){

regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread timotheecour
See below: import std.stdio; import std.regex; void main(){ "h(i".replace!(a=>a.hit~a.hit)(regex(`h\(`,"g")).writeln; //this works, but I need to specify the escape manually // "h(i".replace!(a=>a.hit~a.hit)(regex(`h(`,"gl")).writeln; //I'd like this to work with a flag, say 'l' (lowercase L

Re: how to have alias this with an unaccessible member?

2013-05-22 Thread timotheecour
On Sunday, 19 May 2013 at 14:33:32 UTC, Ali Çehreli wrote: On 05/19/2013 05:34 AM, Simen Kjaeraas wrote: Well, there is also opDot: What is the state of opDot? According to the change log, it has been introduced as a part of "Version D 2.013 Apr 22, 2008" with the note "Added opDot, which is

Re: Two easy pieces

2013-04-01 Thread timotheecour
IMO, there's too little value in those ufcsWritef, ufcsWritefln, ufcsWriteln, ufcsWritefln to justify adding them. When does it stop?? Why not introduce 'tap', which is more generic and has been proposed before: something like this: T tap(alias fun,T)(T a){ fun(a); return a; } Then: aut

how to demangle a string ending __ModuleInfoZ ?

2013-03-22 Thread timotheecour
void main(){ import std.demangle; import std.stdio; writeln(demangle("_D5tango4text7convert6Format12__ModuleInfoZ")); //_D5tango4text7convert6Format12__ModuleInfoZ writeln(demangle("_D5tango4text7Unicode6toFoldFAxaAaZAa")); //char[] tango.text.Unicode.toFold(const(c

replace phobos makefile and tools makefile with D

2013-03-19 Thread timotheecour
Can we replace phobos' and tools' Makefile with D with following advantages: * no more 3 distinct files (posix.mak,win32.mak,win64.mak), instead use version() to maximize code reuse. * less verbosity / bugs / forward compatibility issues eg when a module is added/renamed: eg could take advan

Re: recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
That's opEquals' job. It deals with recursive comparisons like you're describing here just fine. Except the functionality is very different, as opEquals is blind to range semantics. I want equalRecurse to work as follows: struct A{ int[]b=[1]; } void main(){ auto a1=A();

Re: recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
I think I understand what you are after and I like the idea. I've got a few: -typesDeepEqual -typesDeepCmp -deepHash approxEqualRecurse could also be useful for numerical applications (same as equalRecurse, except uses approxEqual for floating point comparisons) https://github.com/patefac

Re: recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
And how do you even have the concept of recursion without some sort of range or container to recursively iterate through? It's not hard: I've done it for a serialization library I've been working on (which has some advantages over std.orange, such as serializing to json/binary etc. more on thi

Re: recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
somewhere else, but I don't see a relevant package. Maybe a new std.algorithm2 for non-ranges? Also, the OT's firstDifference would go there too, and I have a recursive (to specified level) toStringRecurse that would belong there too. Also, I'd add to that list copyRecurse and some more, tha

Re: recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
I think none of you got the point of equalRecurse, so let me clarify. equalRecurse should work on any type, not just inputRanges, see my example in the OT with a struct containing an array: currently std.algorithm.equal has isInputRange conditions on the arguments. So, yes, it can go deep in

recursive equal, and firstDifference functions

2013-03-19 Thread timotheecour
we need a std.algorithm.equalRecurse(T1,T2)(T1 a, T2 b) that compares recursively a and b; its behavior should be: if opEqual is defined, call it else, if its a range, call std.algorithm.equal (ie compare nb elements, then each element for equality) else, if it's a class/struct, make sure type

Re: uniqStable

2013-03-18 Thread timotheecour
I forgot unittest: unittest{ assert(uniqStable([1,3,1,0,2] ==[1, 3, 0, 2] )); } of course, it needs template on less, etc.

Re: rdmd -cov generates bad file names with absolute directories or .. directories in -I flag

2013-03-18 Thread timotheecour
It's not an RDMD issue, it's Druntime. Specifically the baseName function in src/rt/cover.d. This can easily be fixed. Should I file a BUG/enhancement request? The problem is Druntime can't have dependencies to Phobos. Sure, I meant reusing same functionality (rewritten in C++) so there's n

compile time coverage: dmd -staticcov

2013-03-18 Thread timotheecour
Why not have a -staticcov (or -ctcov) flag to dmd that produces compile time code coverage? This will work for most code (with the exception of virtual methods called from a base class -- anything else?): it'll just produce 1 or 0 depending for each line compiled in, depending on whether it's r

rdmd -cov generates bad file names with absolute directories or .. directories in -I flag

2013-03-18 Thread timotheecour
rdmd -cov /Users/timothee/test/test_01.d creates a file "-Users-timothee-test-test_01.lst" A) This leading "-" in filename is very unix unfriendly, eg: mv "-Users-timothee-test-test_01.lst" temp.lst yields: mv: illegal option --U, etc. Even worse in the following case: rdmd --force -cov -I.. ../

most ddoc examples not runnable; Edit is buggy; DDOC generates wrong Example tag

2013-03-12 Thread timotheecour
Is there any short term plan to make examples in ddoc runnable? right now, the only one that runs is the one on the home page dlang.org. Example: in http://dlang.org/phobos/std_path.html: the 1st code sample (under baseName) when you click on run: /home/c318/c110.d(2): Error: Declaration expec

Re: What xml libraries are people using?

2013-03-03 Thread timotheecour
On Saturday, 2 March 2013 at 18:42:13 UTC, Andrej Mitrovic wrote: On 3/2/13, simendsjo wrote: Which can you recommend? I use ae's lite xml library: https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d It's not a monster but thanks to UFCS I can easily extend it to do what I want.

Re: why does array appending add a page size instead of doubling ?

2013-02-03 Thread timotheecour
One more: Did you try using std.container.Array? Even if appender is more optimized than naked array appending, it still has to work with the underlying system. std.container.Array should be able to do just as well as vector, or better (D move semnantics). it's a bit better (see below for

Re: why does array appending add a page size instead of doubling ?

2013-02-03 Thread timotheecour
Note that dynamic arrays are generic containers, so they aren't exactly optimized for anything. You could try that test with the "made for appending" std.array.appender: It always tries to extend without reallocating, and only relocates when the current memory segment is 100% full. Furthermor

Re: shell doesn't throw on error. Is that a regression?

2013-02-02 Thread timotheecour
On Sunday, 3 February 2013 at 02:28:26 UTC, timotheecour wrote: here goes: http://d.puremagic.com/issues/show_bug.cgi?id=9444 please see my added comment in 9444 regarding capturing std err instead of displaying it. actually the new std.process pull request (http://forum.dlang.org/thread

Re: shell doesn't throw on error. Is that a regression?

2013-02-02 Thread timotheecour
here goes: http://d.puremagic.com/issues/show_bug.cgi?id=9444 please see my added comment in 9444 regarding capturing std err instead of displaying it.

why does array appending add a page size instead of doubling ?

2013-02-02 Thread timotheecour
What's the rationale behind array appending adding a page size to capacity instead of doubling, after the size of the array reaches a certain size (cf what std::vector does) ? That seems like an example of (evil?) early optimization. T[]a; int n=some big value; foreach(i;0..n) a~=T.in

shell doesn't throw on error. Is that a regression?

2013-02-02 Thread timotheecour
The doc for std.process.shell says "If the process could not be started or exits with an error code, throws an exception." However on OSX I'm having a different kind of behavior. Isn't there a unittest to test this? --- import std.process; import std.stdio; void main(){ shell("asfasfas

Re: More automated interfacing of D with C codebases

2012-10-22 Thread timotheecour
correction regarding macros: myheader.h: #define MEX_INFORMATION_VERSION 1 interface file myheader.i: %{ %include "myheader.h" %} %include myheader.h generated d file will contain: int MEX_INFORMATION_VERSION() @property { auto ret = swig.mex_im.swig_mex_MEX_INFORMATION_VERSION_get(); retu

Re: More automated interfacing of D with C codebases

2012-10-22 Thread timotheecour
SWIG requires some kind of interface files, which I assume one must have to manually write. Then what's the difference? These can be as small as: sfml.i: %{ #include %} %include SFML/Config.hpp %include SFML/Audio/Export.hpp In practice, some additional tweaks may be needed to support certa

Re: More automated interfacing of D with C codebases

2012-10-21 Thread timotheecour
Manually porting of C/C++ libraries shouldn't be the way to go (a major problem being when said library gets updated, human errors, porting to different architectures etc). I've had good experience using SWIG to automate the job for me, and used it successfully to port the following libraries to

Re: import inside function sometimes causes link errors

2012-10-19 Thread timotheecour
It's a rather recent feature, there's probably a few bugs. Feel free to file: http://d.puremagic.com/issues/ done: http://d.puremagic.com/issues/show_bug.cgi?id=8856

import inside function sometimes causes link errors

2012-10-19 Thread timotheecour
does D fully support using import statements inside functions? I sometimes get link errors eg: void fun(){ import mypackage.mymodule; mypackage.mymodule.myfun(); //will cause link error } if you haven't encountered it yet I can provide a simplified test case.

incomprehensible bug with import side effects

2012-10-19 Thread timotheecour
I've filed the following bug: see Issue 8854 (http://d.puremagic.com/issues/show_bug.cgi?id=8854) I'm curious as to what could cause such a bug, which disappears when doing any of the following seemingly innocuous changes, such as change a file name, change an import path, removing an (unused)

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-04 Thread timotheecour
On Thursday, 4 October 2012 at 19:20:54 UTC, Jacob Carlborg wrote: On 2012-10-04 20:13, timotheecour wrote: I'm fine with that (and already doing this, to call Runtime.initialize), but that doesn't solve the issue of this thread. No, not if you need to redefine functions. Even

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-04 Thread timotheecour
If you're developing a library or similar you could have a requirement that the user need to call "Library.initialize()" before use. But of course, that's something anyone would like to avoid. I'm fine with that (and already doing this, to call Runtime.initialize), but that doesn't solve the

Re: redefine extern(C) function in a shared library

2012-10-04 Thread timotheecour
Here, I want to redefine an extern(C) function, not call the existing definition. I mentioned my previous post because I realized that when adding (for example) assert(0) inside the definition extern(C) std_stdio_static_this, it had no effect, which led me to ask this more general question: how

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
What happens if you just call "std_stdio_static_this" the first you do in your main function? In my case I can't: I don't have control over the main function (it could be written in C for example). @property File stdin () { if (!_stdin.p) _stdin.p = &stdinImpl; return _stdi

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
Module constructors if one of the things that don't work properly. I don't know exactly how this works in std.stdio I would need to study the code. If I recall correctly std.stdio uses some kind of hack to avoid circular dependencies that can otherwise occur if two modules, both having module

Re: how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-03 Thread timotheecour
Thanks for the links. Ya, I did see those threads and I understand there are limitations with dynamic load shared libraries, however, your answer is not very helpful. We shouldn't have to wait until they get 100% support to start using them (who knows when that happens); some applications just

how to call std_stdio_static_this from a dynamically loaded shared library (osx)

2012-10-02 Thread timotheecour
How do I call std_stdio_static_this() in std.stdio from a dynamically loaded shared library (osx) ? I need to do this in my scenario: 1) main program is launched 2) dynamic library is created 3) dynamic library is loaded and a function from it is called 4) everything works fine until a writeln(0

how to get version identifiers set during compilation?

2012-09-21 Thread timotheecour
how to get version identifiers set during compilation? ideally would be something like: enum versions=VersionFlags;//returns ["OSX","debug"] for example one use case is to have arbitrary logic on versions without requiring new syntax. eg: static if(VersionFlags.canFind("OSX") && !VersionFlag

Re: tuple(tuple(1)) fails to compile, but tuple(tuple(1),1) works

2012-09-20 Thread timotheecour
On Thursday, 20 September 2012 at 23:03:34 UTC, timotheecour wrote: inconsistent: auto a1=tuple(tuple(1));//CT error auto a2=tuple(tuple(1),1);//works bug? I filed it here: http://d.puremagic.com/issues/show_bug.cgi?id=8702

tuple(tuple(1)) fails to compile, but tuple(tuple(1),1) works

2012-09-20 Thread timotheecour
inconsistent: auto a1=tuple(tuple(1));//CT error auto a2=tuple(tuple(1),1);//works bug?

inconsistent behavior with "is a nested function and cannot be accessed from"

2012-09-18 Thread timotheecour
The code below fails to compile with: Error: function main.fun!(cast(ModeScore)0,int).fun.map!(__lambda33).map!(int[]).map is a nested function and cannot be accessed from main.fun!(cast(ModeScore)1,int).fun which is weird. But then comment out line B or line A (see below) and it works, whi

Re: template class name unconsistent behavior

2012-09-16 Thread timotheecour
done: http://d.puremagic.com/issues/show_bug.cgi?id=8674

Re: template class name unconsistent behavior

2012-09-16 Thread timotheecour
If this behavior is not a bug, I wonder what's the rationale, but also, how can we have such a "make" function that doesn't mess up the template class name depending on the order of which is used first (the make!T variant or the new A!T) ?

Re: member function as template parameter workaround needed

2012-09-13 Thread timotheecour
I filed 2 bugs: http://d.puremagic.com/issues/show_bug.cgi?id=8653 cannot take address of auto-return function declared in outside module: "Error: forward reference" http://d.puremagic.com/issues/show_bug.cgi?id=8654 cannot take address of function which is 1)overloaded, 2) templated, and 3

Re: member function as template parameter workaround needed

2012-09-13 Thread timotheecour
On Friday, 14 September 2012 at 00:31:15 UTC, Andrej Mitrovic wrote: On 9/14/12, timotheecour wrote: It has issues when the class is defined in a different modules, but not always! This looks like a compiler bug. Feel free to file it in http://d.puremagic.com/issues/ I will. here'

Re: member function as template parameter workaround needed

2012-09-13 Thread timotheecour
Why not pass it as a runtime argument? void run(Fun, T...)(Fun fun, T args) Yes I actually ended up doing that however the behavior seems very buggy / unpredictable. It has issues when the class is defined in a different modules, but not always! Here's a very weird example: file main.d: -

member function as template parameter workaround needed

2012-09-13 Thread timotheecour
As part of a larger system (which converts function parameters to a suitable type), I need to solve the following: pass a member function to a "run" template function, access its ParameterTypeTuple, and actually be able to run the function. I've simplified the problem (see below). Is there a wa

Re: object.factory with template classes for serializing subclasses automatically

2012-09-10 Thread timotheecour
Also, now that I think about it, why couldn't you do this? (it's equivalent): auto serialize(T)(T a) { auto c = cast(SerializerBase) new Serializer!T; return c.serialize(a); } that won't work with my example: class A{} class B:A{int x;} A a=new B; auto c=serialize(a); => T is A, but we

Re: object.factory with template classes for serializing subclasses automatically

2012-09-10 Thread timotheecour
I don't understand how Object.factory could help with serializing. But what would help is if we did get proper runtime reflection. All that'd be needed would be to have Object.factory working with templates, here's how: unittest{ class A{} class B{int x;} A a=new B; auto

Re: Find indexes of elements matching a given value in an array

2012-09-09 Thread timotheecour
Here's a modification to: 1) hide the intermediate struct (as usual in std.algorithm, I forgot what this trick is called) 2) work with ranges, not just arrays (ie will work with iota, see unittest) 3) accept input without "in" attribute; 4) accept arbitrary predicate, not just "==x" Please co

Re: inconsistent behavior with implicit imports

2012-09-09 Thread timotheecour
This is a quirk of DMD, not a language feature. You can file the implicit import behaviour as a bug. done: http://d.puremagic.com/issues/show_bug.cgi?id=8636

Re: filter out compile error messages involving _error_

2012-09-09 Thread timotheecour
On a related note, it would be much clearer if the error messages used fullyQualifiedName!T instead of just the type name T, as in more complex code, there WILL be name clashes. I would guess this would be easy to fix. On Monday, 10 September 2012 at 00:30:54 UTC, Jonathan M Davis wrote: On M

Re: delegate from lambda expression

2012-09-09 Thread timotheecour
Thanks! the template alias ID solves my problem. Your code doesn't look good, What was wrong with it and what would you suggest to improve it? Also, I noticed you replaced (among other things): a.map!dg.array by a.map!dg().array() Will the way I'm skipping "()" ever be deprecated? One of th

filter out compile error messages involving _error_

2012-09-09 Thread timotheecour
Can we filter out compiler errors involving _error_ as template parameter? Clearly the error is coming from upstream so there's no need to even show those. eg: Error: template mypackage.mymodule.myfunction cannot deduce template function from argument types !()(_error_)

inconsistent behavior with implicit imports

2012-09-09 Thread timotheecour
This works: import std.stdio; void main(){ writeln(std.conv.to!double(1)); } This doesn't compile: import std.stdio; void main(){ std.stdio.writeln(std.conv.to!double(1)); } =>Error: undefined identifier std So it seems for conv, import std.conv is not needed,

import all except specified symbols: eg import std.stdio:!writeln,write;

2012-09-09 Thread timotheecour
I'd like to have something like: --- import std.stdio:!writeln,write; --- which would import all symbols from std.stdio except the ones listed (writeln,write). Use case: The reason is to avoid writing verbose code (specifying all symbols to import except those 2), example when writing a module

object.factory with template classes for serializing subclasses automatically

2012-09-09 Thread timotheecour
Is there a way to use Object.factory with template classes? eg: class A(T){ T x; } auto a=Object.factory("A!int"); Right now this fails (returns null). Use case: If we had this, it would GREATLY simplify serialization (eg as in the orange library) by not having to manually register

delegate from lambda expression

2012-09-09 Thread timotheecour
I'd like to achieve the following: import std.stdio,std.range,std.algorithm,std.array; void main(){ auto dg=a=>a*2; auto a=iota(0,10); writeln(a.map!dg.array); } but this doesn't compile: Error: variable [...]dg type void is inferred from initializer delegate (__T26 a) { retur

Re: trying setjmp or throwing from signal handler crashes on OSX

2012-09-02 Thread timotheecour
Since this is kind of low level I would guess you cannot just take a Linux guide and have it work on Mac OS X. Both are Posix but at this low level the differences between the platforms start to show up. BTW, I get "Error: undefined identifier ucontext_t" when compiling that file on Mac OS X.

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

2012-08-24 Thread timotheecour
related threads: http://www.digitalmars.com/d/archives/digitalmars/D/learn/3530.html from Don Clugston: I have implemented compile-time demangle metafunctions: static assert( prettynameof!(A)== "class main.A" ); static assert( qualifiednameof!(A) == "main.A" ); static assert( symbolnameof!(A

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

2012-08-24 Thread timotheecour
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 be hard to convert to what I want, but de