`printName(alias var)()` is not a great solution, eg: doesn't work
with expressions, doesn't work with variadics, introduces template
bloat.
https://github.com/dlang/dmd/pull/7821 introduces
__traits(getCallerSource, symbol) which will allow what you want.
On Sun, Mar 4, 2018 at 1:53 PM, bauss vi
also related: https://github.com/Syniurge/Calypso/issues/85
(feasibility of extending calypso to do source to source translation
(eg C++ => D or C=>D) )
On Thu, Feb 22, 2018 at 12:43 AM, ketmar via Digitalmars-d-learn
wrote:
> Nick Sabalausky (Abscissa) wrote:
>
>> Are there any tutorials or art
:08 UTC, Timothee Cour wrote:
>>
>> I guess you mean `version(StdDdoc)` ?
>>
>> On that note, I see things like this, which are not DRY:
>
>
> This is actually one of the reasons why I abandoned dmd for my dpldocs.info
> fork and used an independent parser.
>
February 2018 at 10:09:12 UTC, Timothee Cour wrote:
>>
>> I'm curious whether scope guards add any cost over the naive way, eg:
>>
>> ```
>> void fun(){
>> ...
>> scope(success) {bar;}
>> ...
>> }
>> ```
>>
>> vs:
&g
at 2:09 AM, Timothee Cour wrote:
> I'm curious whether scope guards add any cost over the naive way, eg:
>
> ```
> void fun(){
> ...
> scope(success) {bar;}
> ...
> }
> ```
>
> vs:
>
> ```
> void fun(){
> ...
> if(foo1){
&g
I'm curious whether scope guards add any cost over the naive way, eg:
```
void fun(){
...
scope(success) {bar;}
...
}
```
vs:
```
void fun(){
...
if(foo1){
bar; // add this before each return
return;
}
...
bar;
return;
}
```
For scope(success) and scope(failure), the
2018 at 11:21 PM, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Wednesday, February 07, 2018 13:39:55 Timothee Cour via Digitalmars-d-
> learn wrote:
>> ```
>> void fun_bad3(T)(T a); // declaration [1]
>> void fun_bad3(T)(T a){}; // definition [2]
>> void tes
```
void fun_bad3(T)(T a); // declaration [1]
void fun_bad3(T)(T a){}; // definition [2]
void test(){
fun_bad3(1);
}
```
Error: test_all.fun_bad3 called with argument types (int) matches both:
main.d(11): test_all.fun_bad3!int.fun_bad3(int a)
and:
main.d(12): test_all.fun_bad3!int.fun_b
https://github.com/dlang/phobos/pull/6133
On Tue, Feb 6, 2018 at 1:40 PM, Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Tuesday, February 06, 2018 18:58:43 number via Digitalmars-d-learn wrote:
>> https://dlang.org/phobos/std_file.html#dirEntries
>>
>> >> The name of each iterated director
https://github.com/opencv/opencv/issues/6585#issuecomment-221842441
snip:
> "C-API" is not supported and should be removed totally (but we have a lack of
> resources to port this legacy C code to C++, so some of this code still
> exists right now). Also huge part of fresh OpenCV functionality is
Calypso (https://github.com/Syniurge/Calypso/) is the most promising
way to interface with C++, it requires 0 bindings and understands all
of C++ (templates etc); there are some caveats/kinks that are being
ironed out (and any help is welcome).
On Sun, Feb 4, 2018 at 4:37 AM, rjframe via Digitalm
see also https://github.com/Syniurge/Calypso/ although I'm having lots
of issues using it on OSX
On Fri, Jan 5, 2018 at 9:02 AM, qznc via Digitalmars-d-learn
wrote:
> I'm exploring [0] C++ interop after watching Walter's presentation [1].
>
> I hit a block with classes as template parameters. Thi
why does unittest mangled name now contains full file path instead of
fully qualified module name?
seems like a regression, previous behavior seemed better and not
dependent on installation path.
I use protocol buffers (using dproto) for this, storing my settings in
either text or wire format. Advantages: type-safety with fwd/backward
compatibility (unlike json which requires dynamic field access, eg
with dproto you get errors at compile time instead of runtime),
supports comments (although
NOTE: curious about both cases:
* thread local
* shared
On Tue, May 16, 2017 at 8:04 PM, Timothee Cour wrote:
> what's the best D equivalent of C++11's function local static initialization?
> ```
> void fun(){
> static auto a=[](){
> //some code
>return some
what's the best D equivalent of C++11's function local static initialization?
```
void fun(){
static auto a=[](){
//some code
return some_var;
}
}
```
(C++11 guarantees thread safety)
Getting this:
```
Deprecation 16211 warning:
A cycle has been detected in your program that was undetected prior to DMD
2.072. This program will continue, but will not operate when using DMD 2.073
to compile. Use runtime option --DRT-oncycle=print to see the cycle details.
```
Where is ` --DRT-on
indeed. NOTE: ldmd2/ldc2 doens't have this issue
to reproduce:
```
rdmd --force --eval='writeln(`hello`)'
```
ld: warning: pointer not aligned at address 0x1000BE0B9
(_D53TypeInfo_S3std5array17__T8AppenderTAyaZ8Appender4Data6__initZ +
24 from .rdmd-501/rdmd-eval.o)
with `--compiler=ldmd2`
This and some other recent posts (`Is this a bug?`, `Hopefully a simple
question...`). If you want help (and help other ppl who search for similar
issues), could you please make the subject more descriptive?
On Fri, Jan 20, 2017 at 12:19 AM, Chris M. via Digitalmars-d-learn <
digitalmars-d-learn
what's the best (and DRY) way to achieve:
```
static if(__traits(compiles, expr))
fun(expr);
```
ie, without repeating the expression inside expr?
eg:
```
static if(__traits(compiles, foo.bar[2])){
counter++;
writeln(" expr = ", foo.bar[2]);
}
```
My 2 cents: for most applications, hotspots tend to be in a tiny percentage
of the code (ie 90/10 rule where 10% of code accounts for 90% execution
time, although my experience in large projects is even more unbalanced) ;
throwing away druntime or GC for the whole codebase based on performance
conc
What's the difference bw _Z21test_D20161202T141925IiET_S0_ and
_Z21test_D20161202T141925IiEii? mangleof produces the one that's not in the
library produced:
test.cpp:
```
template
T test_D20161202T141925(T a);
template int test_D20161202T141925(int);
```
clang++ -shared -o libtest.so test.cpp
c+
I want to update a library with new symbols (ie partial recompilation):
libmylib.so : compiled from bar.d and foo.d
now update the file foo.d
dmd -c -fPIC foo.d -offoo.o
clang++ -o libmylib_update.so foo.o -shared -Wl,-lmylib
When trying to dlopen libmylib_update.so from C++ it fails with:
The
eg:
```
dlib.d:
extern(C) void dfun(){assert(0, "some_msg");}
clib.cpp:
extern "C" void dfun();
void fun(){
try{
dfun();
}
catch(...){
// works but how do i get "some_msg" thrown from D?
}
}
```
#15: 0x7fff89ad65ad libdyld.dylib start + 1
Ideally there should be a way (via a runtime or compile time option) to
wrap the exception throwing (during rt_moduleCtor) inside a extern(C)
function that we can put a breakpoint on (and possibly even call
backtrace_symbols on)
On Sun, Nov 27, 2016 a
in the process of trying to debug
https://github.com/BlackEdder/ggplotd/issues/32 I would like to get a
stracktrace and/or put a breakpoint before exception is thrown:
```
lldb $binary
r
(lldb)
Process 34168 resuming
object.Exception@../../../../.dub/packages/gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d(1
mangle!(void function())("foo").demangle returns "void function()* foo"
how would i get instead: `void foo ()` ?
my current workaround:
alias FunctionTypeOf(Fun)=typeof(*Fun.init);
mangle!(FunctionTypeOf!(void function()))("foo")
in zip: why isn't requireSameLength the default?
This is the most common case and would fit with the goal of being safe by
default.
see also:
https://github.com/rejectedsoftware/vibe.d/issues/1431 api to find an
available port
On Fri, Mar 18, 2016 at 2:50 AM, Marc Schütz via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> Looking at an strace of nmap, it seems it opens a bunch of sockets, puts
> them into
would be easy with compiler as a library...
also i thought 'dmd -v -version=foo -c -o- bar.d' would show -version
identifiers used on the command line but doesn't seem to
On Tue, Mar 15, 2016 at 8:51 AM, Iakh via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, 13 Marc
It would be nice to have an api to get stacktrace across threads; it would
be particularly useful for server applications (eg vibe.d).
Has anyone implemented something similar?
I guess one would need to use signal handlers to interrupt each thread?
On Wed, Jan 13, 2016 at 10:13 AM, jmh530 via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 12 January 2016 at 21:48:39 UTC, Per Nordlöw wrote:
>
>> Have anybody been thinking about adding a scale-hierarchy structure on
>> top of ndslice?
>>
>
> What is a scale-hiera
On Thursday, 23 August 2012 at 13:56:05 UTC, Philippe Sigaud
wrote:
On Tue, Aug 21, 2012 at 6:43 AM, Bobby Bingham
wrote:
[...]
[...]
A possibility is to use a function template, passing the double
as a template argument:
string test(double d)() // d is a template argument
{
return
On Mon, Oct 12, 2015 at 11:33 AM, ric maicle via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 13 October, 2015 01:46 AM, anonymous wrote:
>
>> On Monday 12 October 2015 17:38, ric maicle wrote:
>>
>> I'm wondering if this small irregularity should be made consisten
main.d:
--
struct A(T, int D) {
this(string ignore){}
}
alias B(T)=A!(T, 1);
void fun1(T)(A!(T,1) a) { }
void fun2(T)(B!T a) { }
unittest{
auto a=A!(double,1)("a");
assert(is(typeof(a) == B!double));
fun1(a);//ok
fun2!double(a);//ok
// no IFTI here:
//fun2(a);//not ok:
https://github.com/D-Programming-Language/dmd/pull/4823
On Sun, Jul 19, 2015 at 10:42 PM, ZombineDev via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Monday, 20 July 2015 at 03:33:08 UTC, Timothee Cour wrote:
>
>> I've attached a reduced us
I've attached a reduced use case showing that the solutions proposed in
this thread do not work, and wrote a local modification to dmd to allow a
flag -exclude_cwd_from_imports that does work. Would that be acceptable to
have this in official dmd?
On Sun, Jul 19, 2015 at 8:07 PM, Timothee
https://issues.dlang.org/show_bug.cgi?id=14811
On Wed, Jun 17, 2015 at 3:22 AM, Liran Zvibel via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Monday, 8 June 2015 at 04:08:55 UTC, Adam D. Ruppe wrote:
>
>> The easiest way is to not use search paths, and instead pass all the
Note:
should work with any types, eg:
shared(T[])* => T[]*
etc...
On Sun, Jun 28, 2015 at 4:42 PM, Timothee Cour
wrote:
> How would I cast away shared for a given expression?
> I can write it for a specific type but I'd like to have a generic way to
> do so.
> Also, Unqual doesn't help here.
>
>
How would I cast away shared for a given expression?
I can write it for a specific type but I'd like to have a generic way to do
so.
Also, Unqual doesn't help here.
thanks, missed that!
On Sat, Jun 27, 2015 at 2:59 AM, via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Saturday, 27 June 2015 at 03:17:49 UTC, Timothee Cour wrote:
>
>> is there a way to convert a string representing a time (without date) to a
>>
is there a way to convert a string representing a time (without date) to a
time, eg:
auto t = "19:03:40.143656";
auto a=SysTime.fromTimeString(t); // doesn't exist
My current workaround is to append a dummy date before and then
calling SysTime.fromSimpleString.
Is there a better way? seems need
Suppose I have:
import std.range;
auto a=iota(complex_expr_returning_3());
I'd like to have a function/trait/template/compiler magic that takes
variable a and generates a string that can be mixed in to represent the
type of a. The difficulty is that typeid(a).to!string doesn't work for
Voldermort
I understand this is legal for declaration wo definition (void fun(int);)
but why allow this:
void test(int){} ?
On Mon, Jun 8, 2015 at 11:32 PM, Jonathan M Davis via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Monday, June 08, 2015 23:18:50 Timothee Cour via Digitalmars-d-learn
> wrote:
> > nim has both overloading and named arguments (with reordering and
>
nim has both overloading and named arguments (with reordering and defaults
allowed): http://nim-lang.org/docs/tut1.html#procedures-named-arguments
and it doesn't seem to cause issues.
Is there a document / thread that explains the argument against named
arguments in more details than 'do not play
On Mon, Jun 8, 2015 at 12:08 AM, Adam D. Ruppe via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> The easiest way is to not use search paths, and instead pass all the
> modules you want compiled to the compiler directly. Then it will look for
> the module name declaration instea
ping?
On Sun, Mar 15, 2015 at 10:26 PM, Timothee Cour
wrote:
> Is there a way to exclude current directory from search path in dmd, so
> that the search path is only given by '-I' arguments (+ones from dmd.conf)?
>
> use case:
>
> files:
> /base/foo.d
>
Is there a way to alias attributes?
alias my_alias=pure nothrow @trusted @nogc;
asm @my_alias {...}
This came up here:
https://github.com/Hackerpilot/libdparse/issues/50
Or at least to do the following in a less ugly way?
static if(__VERSION__<2067) enum asm_att=``;
else enum asm_att=`pure noth
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 without default constructor for example (it knows what
the fields should be set to, but doesn't know how to construct the object).
cla
Eg, code like this in std.algorithm:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9][]));
why not just:
assert(equal(setSymmetricDifference(a, b), [0, 5, 8, 9]));
?
Is there a way to exclude current directory from search path in dmd, so
that the search path is only given by '-I' arguments (+ones from dmd.conf)?
use case:
files:
/base/foo.d
/base/bar/foo.d
/base/bar/main.d #contains: import foo.d
cd /base/bar
dmd -I/base main.d
=> I want 'import foo.d' to p
Why can't we allow mixin templates to contain statements, as is the case
for regular mixins?
Is there a workaround?
here's a dummy example:
template mixin Foo{
//some statement, eg: 'return;'
}
void fun(){
mixin Foo;
}
Note that I can do this with a regular mixin, but template mixins are
cle
I'm trying to define a boilerplate mixin for class constructor to generate
code such as:
this(T1 a1, T2 a2){this.a1=a1; this.a2=a2;}
The following works, but fails if one field is from a superclass, with an
error such as:
template instance GenThis!(b, a) GenThis!(b, a) is nested in both B and A.
On Sun, Mar 8, 2015 at 4:36 AM, Jonathan M Davis via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, March 08, 2015 04:13:28 Jonathan M Davis via
> Digitalmars-d-learn wrote:
> > On Saturday, March 07, 2015 17:20:49 Timothee Cour via
> Digi
digitalmars-d-learn@puremagic.com> wrote:
> On Saturday, 7 March 2015 at 23:48:39 UTC, Timothee Cour wrote:
>
>> I'm a little confused about the following:
>> clear,delete,destroy.
>> My understanding is that clear is deprecated and delete is planned to be
>> de
I'm a little confused about the following:
clear,delete,destroy.
My understanding is that clear is deprecated and delete is planned to be
deprecated, so we should only ever use destroy (which deterministic calls
the destructor but doesn't release memory).
Unique uses delete however in the destruct
posted as bugzilla/14243. Am I misunderstanding something here?
On Tue, Mar 3, 2015 at 10:20 PM, Timothee Cour
wrote:
> Template mixin scope seems to have a weird behavior:
> I don't understand 'WEIRD(1)' and 'WEIRD(2)' below.
>
> import std.stdio;
Template mixin scope seems to have a weird behavior:
I don't understand 'WEIRD(1)' and 'WEIRD(2)' below.
import std.stdio;
struct A{
int b;
this(int b){
this.b=b;
writeln("A.begin");
}
~this(){
writeln("A.end");
}
}
mixin template Entry(){
auto a=A(12);
}
void test1(){
Is there a standard way to shallow copy objects?
eg:
class A{
int* a;
string b;
}
unittest{
auto a=new A;
a.a=new int(1);
a.b="asdf";
auto b=new A;
b.shallowCopyFrom(a);
assert(b.a==a.a);
assert(b.b==a.b);
}
How about:
option A1:
void shallowCopyFrom(T)(T a, T b) if(is(T==cla
Is there a simple way to parse a string as a char?
eg:
unittest{
assert(parseChar(`a`)=='a');
assert(parseChar(`\n`)=='\n'); //NOTE: I'm looking at `\n` not "\n"
// should also work with other forms of characters, see
http://dlang.org/lex.html
}
Note, std.conv.to doesn't work (`\n`.to!char do
,2,3,4,5,6];
a.eraseInPlace(1,2);
import std.conv:text;
assert(a==[0,3,4,5,6], text(a));
}
(obviously it assumes no aliasing)
On Tue, Dec 16, 2014 at 6:59 PM, Timothee Cour
wrote:
>
> Is there a phobos way to do eraseInPlace (eg with optimization using
> memmove where appropriate) ? (akin to insertInPlace)
>
Is there a phobos way to do eraseInPlace (eg with optimization using
memmove where appropriate) ? (akin to insertInPlace)
ping?
On Tue, Sep 9, 2014 at 6:48 PM, Timothee Cour
wrote:
> How to redirect io in spawnProcess (eg stderr to stdout)?
>
> is it safe to use it with a same File object for stderr and stdout as
> follows?
> Couldn't find this in the docs.
>
> auto logFile =File(...
How to redirect io in spawnProcess (eg stderr to stdout)?
is it safe to use it with a same File object for stderr and stdout as
follows?
Couldn't find this in the docs.
auto logFile =File(...);
auto pid = spawnShell(command,
std.stdio.stdin,
logFile
Is there a way to specify buffering mode
(unbuffered,line-buffered,block-buffered) in spawnShell + friends?
This is very useful to have in many applications, eg for logging where one
wants to view in progress log results without waiting for entire process to
complete or for a 40960-sized block to b
Is there way to declare a extern(C) function inside a function without
altering the mangled name?
Should I write a mixin for that based on pragma(mangleof) (used as
extern_C_global_scope in example below) ? Or did someone already implement
that?
extern(C) void foo1();
void fun(){
extern(C) void f
On Thu, Aug 21, 2014 at 7:26 PM, Dicebot via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> http://dlang.org/phobos/std_typecons.html#.RefCounted
That doesn't work with classes though; is there any way to get a ref
counted class?
(and btw RefCounted should definitely appear i
What would be a good answer to this article?
http://swiftcoder.wordpress.com/2009/02/18/raii-why-is-it-unique-to-c/
Especially the part mentioning D:{
D’s scope keyword, Python’s with statement and C#’s using declaration all
provide limited RAII, by allowing resources to have a scoped lifetime, bu
dmd 2.066(rc) generates warning: 'Deprecation: Read-modify-write operations
are not allowed for shared variables. Use core.atomic.atomicOp!"-="(a, 1)
instead.' for following code:
synchronized {
++a;
}
Is that correct given that it's inside synchronized?
On Wed, Aug 6, 2014 at 12:04 PM, via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Wednesday, 6 August 2014 at 16:48:57 UTC, Timothee Cour via
> Digitalmars-d-learn wrote:
>
>> Thanks, I know with statement could be used but I was hoping for a
>>
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)
Thanks, I know with statement could be used but I was hoping for a solution
not involving adding syntax to call site.
void fun(with(A){A a}, int b){...} //conceptually like this
void test(){
int a1=1;
fun(A.a1, a1); // would work
fun(a1, a1);// would work
}
On Wed, Aug 6, 2014 at 8:22 AM,
Is there a simple way to to do this?
enum A{
a1,
a2
}
void fun(A a){...}
void test(){
fun(A.a1); //works
fun(a1); //I'd like a1 to work, but just where an A is expected to avoid
polluting namespace.
}
On Sun, Jul 27, 2014 at 9:20 PM, H. S. Teoh via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sun, Jul 27, 2014 at 07:42:17PM -0700, Timothee Cour via
> Digitalmars-d-learn wrote:
> > Just for clarification, I wanted 'myrange.a
Just for clarification, I wanted 'myrange.at(i)' to be the same as
`myrange.dropExactly(i).front`
(so I don't assume it's a random access range).
>> myrange.dropExactly(i).front makes it much more obvious what you're
doing and that it's inefficient. It might be necessary in some cases, but
we don'
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 from
C++'s std::vector::at)
Wouldn't that be nice?
it's all known at CT so why not expose it
among other things it'd allow proper association of modules to files in
stacktraces (sometimes this is impossible / ambiguous), custom user defined
error messages involving lambdas, printing unittest lines etc.
Is there an existing way to do it or do I have to roll my own?
unittest{
assert(escapeC(`a"bc\ndef`~"\n") == `"a\"bc\\ndef\n"`);
}
Likewise with escapeD (pastable in D code), which would return something
like: `r"..."` for more readability
Is there a more idiomatic/elegant way to achieve the following, while
remaining as efficient as possible?
Same question in the simpler case n==0?
using retro seems inefficient because of all the decodings
// returns the largest suffix of a that contains no more than n times c
string findBack(stri
ok I remembered we can use std.typetuple.Alias for that.
On Wed, Jun 4, 2014 at 11:58 PM, Timothee Cour
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 a
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 fun2=fun!int; //OK but needs to specify template params
//none of those work:
//alias
you can use stuff.canFind(2)
but sometimes it'd be more convenient to have the other way around (UFCS
chains etc);
how about:
bool isIn(T,T2...)(T needle, T2 haystack)
if(__traits(compiles,T.init==T2[0].init)){
foreach(e;haystack){
if(needle==e) return true;
}
return false;
}
unittest{
does that work?
string escapeD(string a){
import std.array:replace;
return `r"`~a.replace(`"`,`" "\"" r"`)~`"`;
}
On Sun, Apr 20, 2014 at 11:14 AM, monarch_dodra via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, 20 April 2014 at 17:55:25 UTC, Ellery Newcomer wrote:
On 3/22/05, 3:00 PM, AEon wrote:
Jan Knepper wrote:
Testing Modzilla Thunderbird...
AEon
test2
On 3/22/05, 3:00 PM, AEon wrote:
Jan Knepper wrote:
Testing Modzilla Thunderbird...
AEon
test
Thanks! your solution is more robust (minus some caveats i mentioned) and
also trivially extends to variadics.
On Tue, Mar 11, 2014 at 2:07 PM, monarch_dodra wrote:
> On Tuesday, 11 March 2014 at 05:37:25 UTC, Timothee Cour wrote:
>
>> void writelnIfNotEmpty(T)(T a){
>
On Mon, Mar 10, 2014 at 9:14 PM, Jonathan M Davis wrote:
> On Monday, March 10, 2014 21:50:25 Nick Sabalausky wrote:
> > On 3/10/2014 9:24 PM, Timothee Cour wrote:
> > > Is there a way to do the following lazily:
> > >
> > > writelnIfNotEmpty(T)(T a){
>
Is there a way to do the following lazily:
writelnIfNotEmpty(T)(T a){
auto b=text(a);
if(b.length)
writeln(b);
}
ie, without using std.conv.text (which needlessly computes an intermediate
string, which could be quite large) or launching a separate process ?
writelnIfNotEmpty(""); //doesn't pri
On Tue, Mar 4, 2014 at 10:09 AM, Timothee Cour wrote:
> Thanks, that works
> does it make sense to add a function to do that?
> as it stands there are 2 separate ways, cast(void*)Thread.getThis and
> cast(void*)getTid, so having a function would make it the preferred way.
>
>
On Fri, Feb 28, 2014 at 10:27 AM, Martin Nowak wrote:
> On 02/26/2014 10:16 PM, Timothee Cour wrote:
>
>> Currently (on OSX) I can runtime load a D dll from a C program, but not
>> from a D program, which seems silly.
>>
>> Is it possible to runtime load a D shar
On Wed, Feb 26, 2014 at 1:20 PM, Adam D. Ruppe wrote:
> Try compiling your library with -defaultlib= (leaving it blank after the
> equal sign). Then it might work by not loading the symbols for phobos etc
> twice - they will only be linked into the main program.
>
Thanks, but I don't see how that
Currently (on OSX) I can runtime load a D dll from a C program, but not
from a D program, which seems silly.
Is it possible to runtime load a D shared library as a standalone (ie
without sharing GC, runtime or any other data), treating it as if we were
loading from a C program (making no attempt a
thanks!
On Fri, Feb 14, 2014 at 2:14 PM, Jonathan M Davis wrote:
> On Thursday, February 13, 2014 23:37:13 Timothee Cour wrote:
> > Is there a function to do this?
> > If not and I/someone writes it, is there interest to add it to
> std.datetime?
> >
> > Duration
is there a function to get the inverse of escapeShellCommand?
ie:
assert(escapeShellCommandInverse(` foo 'hello world' `)==[`foo`, `hello
world`]);
Is there a function to do this?
If not and I/someone writes it, is there interest to add it to std.datetime?
Duration t = ...;
t.to!string => 5 secs, 889 ms, and 811 μs
t.round.to!string=> 5 secs
t=...;
t.to!string => 889 ms, and 811 μs
t.round.to!string=> 889 secs
Use case: shorter logs
On Thu, Feb 13, 2014 at 5:50 PM, Steven Schveighoffer
wrote:
> On Thu, 13 Feb 2014 19:06:45 -0500, timotheecour
> wrote:
>
> On Thursday, 13 February 2014 at 23:56:35 UTC, Timothee Cour
>> wrote:
>>
>>> how to iterate over an AA by key-value pair (tuple)?
>
is there anything more efficient than this?
auto byKeyValue(T)(T a)if(isAssociativeArray!T){
return a.byKey.map!(b=>tuple(b, a[b]));
}
On Thu, Feb 13, 2014 at 3:56 PM, Timothee Cour wrote:
> how to iterate over an AA by key-value pair (tuple)?
> use case:
> avoid interrupting
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 if there's
already a way.
I reported this here some time ago:
http://d.puremagic.com/issues/show_bug.cgi?id=11501 (dup of
http://d.puremagic.com/issues/show_bug.cgi?id=8298)
and there's a pull request ready, not sure why it isn't being merged
On Sun, Jan 5, 2014 at 10:20 PM, dennis wrote:
> On Sunday, 5 January 2014 at
1 - 100 of 260 matches
Mail list logo