Why aren't Ranges Interfaces?

2015-06-26 Thread Jack Stouffer via Digitalmars-d-learn
I have been learning D over the past three weeks and I came to the chapter in Programming in D on Ranges. And I am a little confused on the choice to make Ranges based on the methods you have in the struct, but not use a interface. With all of the isInputRange!R you have to write everywhere,

Re: Why aren't Ranges Interfaces?

2015-06-26 Thread Jack Stouffer via Digitalmars-d-learn
Thanks for the reply! I understand the reasoning now. On Friday, 26 June 2015 at 18:46:03 UTC, Adam D. Ruppe wrote: 2) interfaces have an associated runtime cost, which ranges wanted to avoid. They come with hidden function pointers and if you actually use it through them, you can get a

Re: Why aren't Ranges Interfaces?

2015-06-26 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 26 June 2015 at 19:40:41 UTC, rsw0x wrote: On Friday, 26 June 2015 at 19:26:57 UTC, Jack Stouffer wrote: Thanks for the reply! I understand the reasoning now. On Friday, 26 June 2015 at 18:46:03 UTC, Adam D. Ruppe wrote: 2) interfaces have an associated runtime cost, which ranges

GDB for D debugging on OS X seems to be broken

2015-08-16 Thread Jack Stouffer via Digitalmars-d-learn
For reference: OSX 10.10.5 GDB 7.9.1 (non apple; from homebrew) yes, it is code signed Compiling with dub: dflags: [-gc, -gs] I would also like to preface this post by saying that everything works fine in GDB on linux. When finding that a bug in my program was a null pointer

Re: How do I find the actual types of the elements in a list of classes?

2015-08-13 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 13 August 2015 at 20:28:33 UTC, Adam D. Ruppe wrote: On Thursday, 13 August 2015 at 20:23:56 UTC, Jack Stouffer wrote: As far as I can tell, there is no way to know the actual type of each of the objects in the list to be able to print: Cast it to Object first, then do the typeid

Re: How do I find the actual types of the elements in a list of classes?

2015-08-13 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 13 August 2015 at 22:20:35 UTC, Justin Whear wrote: foreach (item; parent_list) { if (auto asA = cast(A)item) { asA.method(); } else if (auto asB = cast(B)item) { asB.method2(); } } On Thursday, 13 August 2015 at 22:20:35 UTC, Justin Whear wrote: Thanks Justin and

Re: How do I find the actual types of the elements in a list of classes?

2015-08-13 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 14 August 2015 at 00:06:33 UTC, Adam D. Ruppe wrote: On Thursday, 13 August 2015 at 23:48:08 UTC, Jack Stouffer wrote: In my code, the list can have 20-30 different types of classes in it all inheriting from the same interface, and it doesn't make sense for all of those classes to

Re: How do I find the actual types of the elements in a list of classes?

2015-08-13 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 13 August 2015 at 22:49:15 UTC, Adam D. Ruppe wrote: On Thursday, 13 August 2015 at 21:42:54 UTC, Jack Stouffer wrote: dynamically calling different methods on each object in the list based on its type. The cleanest OO way of doing that is to put the methods you need in the

How do I find the actual types of the elements in a list of classes?

2015-08-13 Thread Jack Stouffer via Digitalmars-d-learn
Given: interface Parent { void method(); } class A : Parent { void method() {} this() {} } class B : Parent { void method() {} void method2() {} this() {} } void main() { import std.stdio; Parent[]

Can't Compile Global Semaphores?

2015-07-27 Thread Jack Stouffer via Digitalmars-d-learn
Hi, I am currently working through a book on the fundamentals of computer concurrency and I wanted to do all of the exercises in D. But I ran into a problem when I tried to have a global semaphore: /usr/local/Cellar/dmd/2.067.1/include/d2/core/sync/semaphore.di(35): Error: constructor

Re: Can't Compile Global Semaphores?

2015-07-27 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 27 July 2015 at 20:12:10 UTC, John Colvin wrote: Yes, but then core.sync.semaphore doesn't support being shared, so... Ok, so I made the code run by using __gshared instead of shared. It seems really odd that a semaphore object doesn't support being shared, this that a bug? Here

Re: observation: D getting a bit complex

2015-08-30 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote: immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(Range segments) if (isInputRange!Range isSomeString!(ElementType!Range)); pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if

Why isn't int[] automatically convertible to long[]?

2015-09-03 Thread Jack Stouffer via Digitalmars-d-learn
pragma(msg, is(int[] : long[])); false Why?

Why is sort allocating in this case?

2015-09-17 Thread Jack Stouffer via Digitalmars-d-learn
The docs explicitly say that SwapStrategy.unstable is non-allocating, but this code (which is for finding the statistical mode of a range) will fail to compile. auto mode(alias pred = "a == b", R)(R r) @nogc if (is(ElementType!R : real) && isInputRange!R && !isInfinite!R) {

Re: Why is sort allocating in this case?

2015-09-17 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 18 September 2015 at 02:24:44 UTC, Adam D. Ruppe wrote: Works for me. What version are you using? Might be the old one wasn't actually marked nogc yet. I'm using the git head, must be a regression.

Re: Why is sort allocating in this case?

2015-09-17 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 18 September 2015 at 02:29:55 UTC, Jack Stouffer wrote: On Friday, 18 September 2015 at 02:24:44 UTC, Adam D. Ruppe wrote: Works for me. What version are you using? Might be the old one wasn't actually marked nogc yet. I'm using the git head, must be a regression. Well apparently

Re: Purity of std.conv.to!string

2015-09-26 Thread Jack Stouffer via Digitalmars-d-learn
On Saturday, 26 September 2015 at 17:08:00 UTC, Nordlöw wrote: Why is the following code not pure: float x = 3.14; import std.conv : to; auto y = x.to!string; ??? Is there a reason for it not being pure? If not, this is a serious problem as this is such a fundamental function.

Re: OS minimum version

2015-09-21 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 21 September 2015 at 12:47:39 UTC, ponce wrote: 3. What is the minimum OS X version required by programs created with LDC? Tiger x86 version, I believe.

Why are static arrays not ranges?

2015-09-21 Thread Jack Stouffer via Digitalmars-d-learn
import std.range; void main() { int[6] a = [1, 2, 3, 4, 5, 6]; pragma(msg, isInputRange!(typeof(a))); pragma(msg, isForwardRange!(typeof(a))); pragma(msg, isRandomAccessRange!(typeof(a))); } $ dmd -run test.d false false false That's ridiculous. Do I have to wrap my static

Re: Why are static arrays not ranges?

2015-09-21 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 21 September 2015 at 20:39:55 UTC, Jesse Phillips wrote: A static array has a constant length, so it is not possible to popFront on a static array. Making a dynamic array from it is easy, just slice it with []: pragma(msg, isInputRange!(typeof(a[]))); pragma(msg,

Re: Regression?

2015-12-08 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 01:35:26 UTC, Sebastiaan Koppe wrote: Thanks for your advice. But that is not what I asked for. The question was, why doesn't this work anymore with the latest (2.068.0 and 2.068.1) compiler: ``` auto ls =

Re: Regression?

2015-12-08 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 01:35:26 UTC, Sebastiaan Koppe wrote: Thanks for your advice. But that is not what I asked for. The question was, why doesn't this work anymore with the latest (2.068.0 and 2.068.1) compiler: ``` auto ls =

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 20:43:02 UTC, Jack Stouffer wrote: unittest { static assert(isInputRange!(ReferenceInputRange!int)); // works static assert(isForwardRange!(ReferenceForwardRange!int)); // works static

isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
I'm trying to add a ReferenceBidirectionalRange range type to std.internal.test.dummyrange so I can test some range code I'm writing, but I've hit a wall and I'm not sure why. For some reason, the isBidirectionalRange check fails even though back and popBack are present. Any help here would be

Re: isBidirectionalRange fails for unknown reasons

2015-12-16 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 21:40:44 UTC, anonymous wrote: The `.save` primitive of forward ranges must return the very same type that the range has. But your ReferenceBidirectionalRange!T.save returns a ReferenceForwardRange!T, because it's inherited. That makes

Re: ndslice and limits of debug info and autocompletion

2015-12-21 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 00:21:16 UTC, Jay Norwood wrote: import std.experimental.ndslice.iteration: transposed; I don't use visualD so I can't help you there, but I wanted to point out that this import is unnecessary.

Re: ndslice of an array structure member?

2015-12-21 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 21 December 2015 at 23:59:07 UTC, Jay Norwood wrote: I'm trying to learn ndslice. It puzzles me why t3 compiles ok, but t4 causes a compiler error in the example below. Should I be able to slice a struct member that is an array? import std.stdio; import std.experimental.ndslice;

Re: Fibers under the hood

2016-06-09 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 9 June 2016 at 16:13:21 UTC, Jonathan Marler wrote: I don't see that documentation anywhere on that page. https://issues.dlang.org/show_bug.cgi?id=16148

Re: std.conv.parse not accepting ByCodeUnitImpl

2016-05-25 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 16:53:30 UTC, Steven Schveighoffer wrote: to should work wherever parse works (in fact, whenever you call to!someType(someString), I believe it just forwards to parse). This is not the case; to doesn't work with ranges: auto str = "1234567".byCodeUnit;

Re: std.conv.parse not accepting ByCodeUnitImpl

2016-05-25 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 18:43:05 UTC, Steven Schveighoffer wrote: If parse can do it, to should as well. I think it's a question of how the template constraints are done. Please file an issue. Found this: https://issues.dlang.org/show_bug.cgi?id=15800

Re: Simple performance question from a newcomer

2016-02-21 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 21 February 2016 at 14:32:15 UTC, dextorious wrote: Now, seeing as how my experience writing D is literally a few hours, is there anything I did blatantly wrong? Did I miss any optimizations? Most importantly, can the elegant operator chaining style be generally made as fast as the

Member Access Based On A Runtime String

2016-02-29 Thread Jack Stouffer via Digitalmars-d-learn
In Python, I can do this: my_obj = Obj() string_from_func = func() setattr(my_obj, string_from_func, 100) Say func() returns "member1" or "member2", the setattr would then set either one of those to 100. Is there any equivalent in D?

Re: char array weirdness

2016-03-28 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 28 March 2016 at 22:43:26 UTC, Anon wrote: On Monday, 28 March 2016 at 22:34:31 UTC, Jack Stouffer wrote: void main () { import std.range.primitives; char[] val = ['1', '0', 'h', '3', '6', 'm', '2', '8', 's']; pragma(msg, ElementEncodingType!(typeof(val)));

Re: char array weirdness

2016-03-28 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 28 March 2016 at 23:07:22 UTC, Jonathan M Davis wrote: ... Thanks for the detailed responses. I think I'll compile this info and put it in a blog post so people can just point to it when someone else is confused.

char array weirdness

2016-03-28 Thread Jack Stouffer via Digitalmars-d-learn
void main () { import std.range.primitives; char[] val = ['1', '0', 'h', '3', '6', 'm', '2', '8', 's']; pragma(msg, ElementEncodingType!(typeof(val))); pragma(msg, typeof(val.front)); } prints char dchar Why?

Re: char array weirdness

2016-03-30 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 05:16:04 UTC, H. S. Teoh wrote: If we didn't have autodecoding, would be a simple matter of searching for sentinel substrings. This also indicates that most of the work done by autodecoding is unnecessary -- it's wasted work since most of the string data is

Re: char array weirdness

2016-03-30 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 22:49:24 UTC, ag0aep6g wrote: When byCodeUnit takes no time at all, isn't 1µs infinite times slower, instead of 100 times? And I think byCodeUnits's 1µs is so low that noise is going to mess with any ratios you make. It's not that it's taking no time at all,

Compiler Specific dub Dependencies

2016-03-23 Thread Jack Stouffer via Digitalmars-d-learn
Is there any way in dub to specify that a module should only be linked and compiled for DMD and not for LDC? I am using the Economic Modeling containers library, and because it uses std.experimental.allocator, it can't be used with LDC through dub. I have coded in such a way with static if's

Re: Member Access Based On A Runtime String

2016-03-02 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 1 March 2016 at 08:53:20 UTC, Adrian Matoga wrote: struct Foo { string foo = "dog"; int bar = 42; int baz = 31337; } void set(P, T)(ref P p, string name, auto ref T value) { foreach (mem; __traits(allMembers, P)) { static if

Empty Associative Aarray Literal

2016-03-03 Thread Jack Stouffer via Digitalmars-d-learn
I want to have one of the parameters on a function be optional. The problem is, is that it's a AA and D does not seem to support empty AA literals. Observe: string func(int a, int[int] b = []) { return "mem1"; } void main() { func(1); } $ dmd test test.d(8): Error: cannot implicitly

Re: char array weirdness

2016-03-29 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 23:15:26 UTC, Basile B. wrote: I've seen you so many time as a reviewer on dlang that I belive this Q is a joke. Even if obviously nobody can know everything... https://www.youtube.com/watch?v=l97MxTx0nzs seriously you didn't know that auto decoding is on and that

Re: char array weirdness

2016-03-31 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 31 March 2016 at 12:49:57 UTC, ag0aep6g wrote: I get theses timings then: auto-decoding 642 ms, 969 μs, and 1 hnsec byCodeUnit 84 ms, 980 μs, and 3 hnsecs And 643 / 85 ≅ 8. Ok, so not as bad as 100x, but still not great by any means. I think I

Re: char array weirdness

2016-03-29 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 23:42:07 UTC, H. S. Teoh wrote: Believe it or not, it was only last year (IIRC, maybe the year before) that Walter "discovered" that Phobos does autodecoding, and got pretty upset over it. If even Walter wasn't aware of this for that long... The link (I think

Re: missing data with parallel and stdin

2016-05-23 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 23 May 2016 at 08:59:31 UTC, moechofe wrote: void delegate(string source,string dest) handler; if(use_symlink) handler = delegate(string s,string d){ symlink(s,d); }; else handler = delegate(string s,string d){ copy(s,d); }; Boy that's a confusing

std.conv.parse not accepting ByCodeUnitImpl

2016-05-23 Thread Jack Stouffer via Digitalmars-d-learn
Consider the following code - import std.range; import std.conv; import std.utf; import std.algorithm; auto test(R)(R s) { auto value = s.byCodeUnit; auto splitValue = value.splitter('.'); parse!int(splitValue.front); } void main() { test("1.8"); } - This fails

Re: std.conv.parse not accepting ByCodeUnitImpl

2016-05-24 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 05:01:39 UTC, ag0aep6g wrote: You're missing that `parse`'s parameter is `ref`. `splitValue.front` is not an lvalue, so it can't be passed in a ref parameter. This works: auto f = splitValue.front; parse!int(f); Thanks. DMD desperately needs

Re: Small-Size-Optimized Array

2016-05-16 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 16 May 2016 at 11:05:40 UTC, Nordlöw wrote: Does Phobos contain any standard small-size-optimized (SSO) array that starts with a stack array and union-converts into a standard builtin D-array when grown beyond the size of the stack array? No. If not has anybody put together one?

Re: std.conv.parse not accepting ByCodeUnitImpl

2016-05-25 Thread Jack Stouffer via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 05:01:39 UTC, ag0aep6g wrote: You're missing that `parse`'s parameter is `ref`. Do you what the rationale behind this is? I just removed the ref from the floating point from input range overload and it works fine for strings.

Re: std.conv.parse not accepting ByCodeUnitImpl

2016-05-25 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 15:34:45 UTC, Steven Schveighoffer wrote: parse consumes data from the string as it goes. I know that, I'm asking why. This disallows the natural range chaining and forces you to save to a variable before calling parse even though the function works just as well

Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
Is it really a problem? What are the pitfalls of defining one but not the other?

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 31 July 2016 at 15:30:15 UTC, LaTeigne wrote: On Sunday, 31 July 2016 at 15:21:01 UTC, Jack Stouffer wrote: Is it really a problem? What are the pitfalls of defining one but not the other? iirc usage in an AA requires both. But D provides a default toHash for every type if it's

Re: Why Does Dscanner Warn About a Missing toHash if opEquals is Defined?

2016-07-31 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 31 July 2016 at 17:48:48 UTC, BLM768 wrote: writeln(n1.hashOf == n2.hashOf); // false = BAD! Ok, yeah that is bad. Next question: what's the fastest hashing implementation that will provide the least collisions? Is there a hash implementation that's perfered for AAs?

Re: shuffle a character array

2016-07-20 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 17:31:18 UTC, Ali Çehreli wrote: making it impossible to access randomly making it impossible to access randomly __correctly__, unless you're safely assuming there's only ASCII in your string.

Re: Go’s march to low-latency GC

2016-07-06 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 6 July 2016 at 16:58:45 UTC, chmike wrote: In case you missed it https://blog.twitch.tv/gos-march-to-low-latency-gc-a6fa96f06eb7#.emwja62y1 This should have been posted in General.

Re: Build a SysTime from a string

2016-07-06 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 6 July 2016 at 15:38:00 UTC, Andrea Fontana wrote: On Wednesday, 6 July 2016 at 14:55:51 UTC, Jonathan M Davis wrote: auto st = SysTime.fromISOExtString("2011-03-02T15:30:00+01:00"); That's perfect. I didn't notice that static method. My fault! Also, if you need to parse other

Re: Implementing a cache

2016-07-03 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 3 July 2016 at 17:15:32 UTC, Lodovico Giaretta wrote: To avoid the ~= operator and reallocations of the cache array, you could impose a max number of cache entries, preallocate the array and use it as a circular buffer. Here's a simple ring buffer I use, feel free to take it

Re: Way to use var instead of auto?

2016-07-03 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 3 July 2016 at 22:00:39 UTC, MMJones wrote: I like the term var better than auto. Is there a way to alias auto? If you're thinking of var as in JS's var, they're not the same thing. Even if you could alias it I would advise against doing something like that; assume your code

Re: Can you read the next line while iterating over byLine?

2017-02-02 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 2 February 2017 at 18:18:13 UTC, John Doe wrote: Let's say you're trying to parse a file format like: Name http://example.com 123234 Foo Bar http://dlang.org 88 with blocks separated by varying amount of blank lines. - import std.stdio; void main(string[] args){

Re: Compile to C?

2017-01-21 Thread Jack Stouffer via Digitalmars-d-learn
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote: Hi friends, Is there a way to "compile" d code to C, similar to what nim does? That would be cool for greater portability. No, and this is actually a terrible idea. See

Re: Returning the address of a reference return value in @safe code - 2.072 regression?

2017-02-20 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 20 February 2017 at 20:54:31 UTC, Jack Stouffer wrote: On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote: ... Yeah, this is another regression caused by DIP1000. Christ. For the record, the current list of regressions caused by DIP1000

Re: Returning the address of a reference return value in @safe code - 2.072 regression?

2017-02-20 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 20 February 2017 at 20:49:43 UTC, Johan Engelen wrote: ... Yeah, this is another regression caused by DIP1000. Christ.

Re: std.container.array.Array is not @nogc?

2017-01-15 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 15 January 2017 at 11:47:06 UTC, drug007 wrote: Is there a way to use Array in @nogc code: ``` import std.container.array : Array; @nogc: void main(string[ ] args) { Array!int ai; ai ~= 1; assert(ai[0] == 1); } ``` fails: ``` main.d(8): Error: @nogc function 'D main' cannot

Re: Changing template parameters

2017-01-16 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 16 January 2017 at 15:32:33 UTC, Dlearner wrote: Hey, quick question! I'm messing around with std.random and noticed that you can change the boundaries parameter to be either open or closed intervals on either side. By default it is "[)". How do I change these template

Re: How to get the name for a Tid

2017-02-27 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 21:04:38 UTC, Christian Köstlin wrote: std.concurrency contains the register function to associate a name with a Tid. This is stored internally in an associative array namesByTid. I see no accessors for this. Is there a way to get to the associated names of a

Re: std.container.array.Array is not @nogc?

2017-01-15 Thread Jack Stouffer via Digitalmars-d-learn
On Sunday, 15 January 2017 at 13:08:52 UTC, drug007 wrote: Thanks for answer. Looking forward for your PR. https://github.com/dlang/phobos/pull/5036

Re: @safe console input?

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 10 March 2017 at 00:42:35 UTC, XavierAP wrote: On Thursday, 9 March 2017 at 23:55:35 UTC, Adam D. Ruppe wrote: Just wrap it in a @trusted function. I knew this answer already of course ;) but I take it as implying that there is no other way. Actually I really wonder why

Re: DMD default safety command line switch

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 10 March 2017 at 01:13:26 UTC, XavierAP wrote: On Friday, 10 March 2017 at 00:48:39 UTC, Jack Stouffer wrote: Don't know the history, but as recently as a week ago Andrei has argued against such behavior has balkanizing the community. What behavior? Anyway my question is answered,

Re: DMD default safety command line switch

2017-03-09 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 9 March 2017 at 17:48:04 UTC, XavierAP wrote: Andrei's 2010 book states that the default safety level can be changed from @system to @safe by means of a -safe command line switch, in the case of the DMD compiler. Now I've tried it and it's not recognized. Was this feature remove

Re: Is DMD breaking BigInt?

2017-04-07 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote: Simple Dub build of a Factorial example using Unit-Threaded for testing. Works fine with ldc2 breaks with dmd. Can you post the code your using?

Re: Recently added __equal

2017-04-17 Thread Jack Stouffer via Digitalmars-d-learn
On Monday, 17 April 2017 at 19:15:06 UTC, Nordlöw wrote: What's the plan for the recent adding __equal overloads at https://github.com/dlang/druntime/pull/1808/files Is it only meant for runtime and phobos to be updated? Or does user-libraries, such as container libraries, need to be updated

Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
Clang has __int128. Is there anyway to use this with D with LDC?

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 15 December 2017 at 02:08:12 UTC, Nicholas Wilson wrote: See also https://github.com/d-gamedev-team/gfm/tree/master/integers/gfm/integers Thanks

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 14 December 2017 at 23:33:34 UTC, Nicholas Wilson wrote: On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? Not really as a plain type, although there is effort to get [u]cent working. I could have

Re: Auto expiring cache library

2018-04-27 Thread Jack Stouffer via Digitalmars-d-learn
On Friday, 27 April 2018 at 09:07:31 UTC, Pasqui23 wrote: I want a library that offers an in-memory data structure,such that I can write,for example: cache.insert(key,value,expiry) and I can retrieve the value with something like cache[key],unless it has passed expiry seconds. Can be

Generating C Headers From D Code

2021-08-05 Thread Jack Stouffer via Digitalmars-d-learn
I need to generate plain C99 .h files from a D module's extern(C) declarations, so that I can link a DMD generated .o file with a C code base. Are there any automated tools which do this? I know the compiler has C++ header generation, and there's tons of tools which exist for importing C

Re: Generating C Headers From D Code

2021-08-06 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 5 August 2021 at 17:02:33 UTC, Tejas wrote: On Thursday, 5 August 2021 at 16:28:35 UTC, Jack Stouffer wrote: I need to generate plain C99 .h files from a D module's extern(C) declarations, so that I can link a DMD generated .o file with a C code base. Are there any automated tools