Re: BetterC and TypeInfo Question
On Friday, 23 June 2017 at 04:03:04 UTC, Adam D. Ruppe wrote: On Friday, 23 June 2017 at 02:49:27 UTC, Mike wrote: My approaches are right now for -betterC to be a filthy hack to get it working quick, and I still have a bunch of ways I want to improve the implementation and compiler interface in the main, non-hack-switch too. Hi! I'm working on a small custom standard library (just because) and I cannot figure out how get object.d smaller. It's a huge mess, with everything defined inside. Could you pass along the 'filthy hack'? I need some way to get object.d to pass through without druntime or phobos, whatsoever. I am importing small modules and functions that I find necessary, but I am not using TypeInfo at all and hope to get rid of the problem.
Alloca copy: What's _pastdata?
I'm creating a minimal DRuntime (for messing around). Right now, I have a very basic program that doesn't even link to the C runtime, and uses syscalls for everything. I'm trying to implement alloca so that I can parse arguments (long story), and so I went to druntime/src/rt/alloca.d. Everything I found there looked OK except for _pastdata. I saw the comment before the function declaration declaring _pastdata to be an extern C variable, and I defined it as such. DMD failed to compile, saying that it cannot load from TLS. I then added '__gshared' to the declaration, but DMD failed again, saying "Cannot directly load global variable with PIC code." Is there any way I can get alloca to work?
Re: Cannot deduce function types for argument
On Sunday, 25 February 2018 at 18:39:31 UTC, ARaspiK wrote: I'm making a calendar (basically improvements to https://wiki.dlang.org/Component_programming_with_ranges) and I'm getting a lot of `cannot deduce function from argument types` errors when using range-based mapping code. Here's my current code: https://pastebin.com/TqAkggEw My testing: `rdmd --eval='import calendar; dateList!(a => a.year > 2013)(2013).chunkBy!myMonth.chunks(3).map!(r => r.map!formatMonth.array().blockMonths(" ").join("\n")).join("\n\n").writeln();'` [...] I figured it out. I had passed incorrect parameters, and it works now. Thanks for reading.
Re: Zip with range of ranges
On Sunday, 25 February 2018 at 20:18:27 UTC, Paul Backus wrote: On Sunday, 25 February 2018 at 16:22:19 UTC, ARaspiK wrote: Instead of passing std.range.zip a set of ranges as different arguments, is it possible to hand the m a range of ranges, and get them to zip together each element of every subrange? `std.range.transposed` does this, but it requires that the range of ranges has assignable elements, so it may not work in all cases. For example: import std.range; import std.algorithm.iteration; import std.stdio; auto rr1 = [[1, 2, 3], [4, 5, 6]]; rr1.transposed.each!writeln; // Works auto rr2 = only(only(1, 2, 3), only(4, 5, 6)); rr2.transposed.each!writeln; // Doesn't work Thank you so much. It works now. I was already receiving a forward range, so copying was easy.
Cannot deduce function types for argument
I'm making a calendar (basically improvements to https://wiki.dlang.org/Component_programming_with_ranges) and I'm getting a lot of `cannot deduce function from argument types` errors when using range-based mapping code. Here's my current code: https://pastebin.com/TqAkggEw My testing: `rdmd --eval='import calendar; dateList!(a => a.year > 2013)(2013).chunkBy!myMonth.chunks(3).map!(r => r.map!formatMonth.array().blockMonths(" ").join("\n")).join("\n\n").writeln();'` My errors: ``` template std.array.array cannot deduce function from argument types !()(MapResult!(formatMonth, Take!(ChunkByImpl!(myMonth, Until!(__lambda2, Recurrence!(__lambda2, Date, 1LU), void), candidates are: std.array.array(Range)(Range r) if (isIterable!Range && !isNarrowString!Range && !isInfinite!Range) std.array.array(Range)(Range r) if (isPointer!Range && isIterable!(PointerTarget!Range) && !isNarrowString!Range && !isInfinite!Range) std.array.array(String)(scope String str) if (isNarrowString!String) instantiated from here: MapResult!(__lambda3, Chunks!(ChunkByImpl!(myMonth, Until!(__lambda2, Recurrence!(__lambda2, Date, 1LU), void instantiated from here: map!(Chunks!(ChunkByImpl!(myMonth, Until!(__lambda2, Recurrence!(__lambda2, Date, 1LU), void ``` Please, can you get this code to work? The commented out function formatYear needs to work properly. The rdmd command-line simply emulates it.
Zip with range of ranges
Instead of passing std.range.zip a set of ranges as different arguments, is it possible to hand the m a range of ranges, and get them to zip together each element of every subrange?
Alias to single function of object inside class
I have a class Foo, which has functions a(), b(), and c(). I have a class Bar that has baz, an instance of Foo. How do I link Bar.b() -> baz.b() without also linking Foo.a() and Foo.c()? I know we can do an alias this, but I only want to link over b().