Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Thursday, 21 January 2016 at 22:02:57 UTC, Dibyendu Majumdar wrote: On Thursday, 21 January 2016 at 21:55:10 UTC, jmh530 wrote: For the latter - on Windows 10 b64-bit - I am using following options for example: -shared -L/LIBPATH:c:\\lib -L//IMPLIB:mylib.lib I'm not having any luck

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Thursday, 21 January 2016 at 22:54:26 UTC, Dibyendu Majumdar wrote: On Thursday, 21 January 2016 at 22:49:06 UTC, jmh530 wrote: I'm not trying to created a shared library in D. My goal is to use a shared library from C in D. Right now, I'm working with a simple test case to make sure I

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Thursday, 21 January 2016 at 22:35:29 UTC, Dibyendu Majumdar wrote: Sorry the option should be -L/IMPLIB:.. - with single slash but you only need this if you are trying to create a shared library which presumably you are not? I believe to create a static library you need to use -lib,

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
I also added an enhancement request: https://issues.dlang.org/show_bug.cgi?id=15588

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Thursday, 21 January 2016 at 21:39:08 UTC, Dibyendu Majumdar wrote: Hi I am also new to D and trying to do similar things - i.e. call a shared library written in C from D, but also create a shared library in D. For the latter - on Windows 10 b64-bit - I am using following options for

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Thursday, 21 January 2016 at 22:14:25 UTC, Dibyendu Majumdar wrote: On Thursday, 21 January 2016 at 22:09:47 UTC, jmh530 wrote: The -L/LIBPATH:c:\lib gives me an error that OPTLINK : Warning 9: Unknown Option : LIBPATH and then gives the path I put is not found. At least when it's

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Friday, 22 January 2016 at 00:43:05 UTC, W.J. wrote: The GNU linker ld, for instance, uses the -l switch for adding libraries to link against and -L to add a search path to look for the libraries passed in with -l. If you leave it to the compiler to invoke the linker you need to

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Friday, 22 January 2016 at 01:34:00 UTC, bachmeier wrote: Have you used pragma(lib)? https://dlang.org/spec/pragma.html#lib There's also a section on it in Learning D. Looks like the sections are split apart by a couple hundred pages. I tried it with the .lib I created earlier without

Re: Linking C libraries with DMD

2016-01-21 Thread jmh530 via Digitalmars-d-learn
On Friday, 22 January 2016 at 04:03:27 UTC, Mike Parker wrote: [snip] Thanks for the detailed reply.

Re: Mixin Template Function Attributes

2016-01-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 19:19:04 UTC, Marc Schütz wrote: On Wednesday, 20 January 2016 at 16:37:31 UTC, jmh530 wrote: I'm not sure if this is how the behavior is supposed to be or if it is a bug. I believe, however, that it _is_ a bug that the imported symbols are visible outside

Re: Mixin Template Function Attributes

2016-01-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 January 2016 at 19:48:04 UTC, jmh530 wrote: On Wednesday, 20 January 2016 at 19:19:04 UTC, Marc Schütz wrote: On Wednesday, 20 January 2016 at 16:37:31 UTC, jmh530 wrote: I'm not sure if this is how the behavior is supposed to be or if it is a bug. I believe, however, that

Mixin Template Function Attributes

2016-01-20 Thread jmh530 via Digitalmars-d-learn
I was thinking about using mixin templates to put some module-level default information in a single file so that it doesn't clutter up other files. It works for imports, but it doesn't seem to propagate for function attributes. module_default.d --- module module_default;

Re: Dense multidimensional std.container.array?

2016-01-26 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 18:07:40 UTC, ZombineDev wrote: [snip] Cool example.

Re: Linking C libraries with DMD

2016-01-22 Thread jmh530 via Digitalmars-d-learn
On Friday, 22 January 2016 at 04:43:52 UTC, Mike Parker wrote: [snip] Thanks again! Will review.

Re: Scala Spark-like RDD for D?

2016-02-16 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 15:03:36 UTC, Jakob Jenkov wrote: I cannot speak on behalf of the D community. In my opinion I don't think that it is D that needs a big data strategy. It is the users of D that need that strategy. I am originally a Java developer. Java devs. create all kinds

Modify Function Pointer to Take Additional Parameters

2016-02-18 Thread jmh530 via Digitalmars-d-learn
I'm trying to write a function that will adjust the parameters of a function pointer. In the code below, my goal is to call the function qux with a variety of different function pointers (in the actual application, I don't have the ability to modify qux). I created a function foo that I

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread jmh530 via Digitalmars-d-learn
On Friday, 19 February 2016 at 11:26:56 UTC, Nicholas Wilson wrote: Like alias fp1 = int function(int x); alias fp2 = int function(int x, int y); auto foo(T)(T f) { static if (is(T == fp2)) return f; else static if (is(T == fp1)) {

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread jmh530 via Digitalmars-d-learn
On Friday, 19 February 2016 at 14:21:26 UTC, Kagamin wrote: int bar(int x) { return x; } int baz(int x, int y) { return bar(x); } void main() { import std.stdio : writeln; int function(int x, int y) foo_bar = writeln(foo_bar(1, 2)); } This

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread jmh530 via Digitalmars-d-learn
On Friday, 19 February 2016 at 15:00:51 UTC, jmh530 wrote: This works. But when I re-write foo to take that into account as in below, I get an error that I can't implicitly convert int function(int x) to int function(int x, int y). I don't think I had looked at what you had done carefully

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread jmh530 via Digitalmars-d-learn
On Friday, 19 February 2016 at 22:07:25 UTC, Chris Wright wrote: If you want to cast function pointers successfully, you have to know the D calling convention. [snip] I figured there was an explanation. Definitely "here be dragons" territory. I hope I can figure out a better solution, but

Re: Modify Function Pointer to Take Additional Parameters

2016-02-19 Thread jmh530 via Digitalmars-d-learn
On Friday, 19 February 2016 at 22:34:48 UTC, Chris Wright wrote: I tested this a fair bit today, and I haven't been able to do any of the nefarious things I expected to be able to do. No overwriting variables in the caller's scope, no smashing stack pointers, etc. I was surprised by this

Re: Simple performance question from a newcomer

2016-02-21 Thread jmh530 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

ldc application unable to start

2016-02-21 Thread jmh530 via Digitalmars-d-learn
I'm playing around with ldc on Windows 64bit. I'm able to compile some simple stuff, but I'm having an issue with something I compile giving an error: The application was unable to start correctly (0xc7b). Click OK to close the application. This is effectively the ldc2 command I had run

Re: ldc application unable to start

2016-02-21 Thread jmh530 via Digitalmars-d-learn
On Sunday, 21 February 2016 at 17:54:30 UTC, Rainer Schuetze wrote: This error code is often caused by a DLL being compiled for the wrong architecture, so I guess that you have some 32-bit DLL in your original folder that is found instead of the 64-bit DLL. That pointed me in the direction

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 18:56:29 UTC, H. S. Teoh wrote: Does this do what you want? I think it does. That's an approach I would not have thought of. I do not really know much about AliasSeq.

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 18:56:29 UTC, H. S. Teoh wrote: Does this do what you want? Okay, I've looked at this a bit more thoroughly and it works perfectly (perhaps with a better name put in phobos?). If I'm understanding this correctly, the ImplType creates the correct type

Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
I wrote a version of cartesianProduct that will return the cartesian product when the some of the types are not ranges. The original code is below. My issue is that I can't figure out how to turn it into a variadic template. The latest thing I tried is: auto mixedCartesianProduct(T...)(T x)

Profile ldc2

2016-04-07 Thread jmh530 via Digitalmars-d-learn
I like how dmd has the -profile switch, but I'm not sure how to go about profiling ldc2. I don't see any compiler flags in the -help. I'm also using Windows, if that matters, but if the best options are on Linux, I can dual-boot.

__traits(compiles) and template instantiation

2016-04-07 Thread jmh530 via Digitalmars-d-learn
I've been playing around with __traits and I find myself confused on one aspect. In the code below, I was testing whether some templates would compile given types. For the most part it works as I would expect. I think I get why the third one works with foo!(int). My guess is that it assumed

Re: __traits(compiles) and template instantiation

2016-04-08 Thread jmh530 via Digitalmars-d-learn
It looks like the bug has already been reported. There are a few associated with __traits(compiles), but this one seems most relevant: https://issues.dlang.org/show_bug.cgi?id=3448 It also suggests that this is relevant: https://issues.dlang.org/show_bug.cgi?id=965

Re: function returning a tuple

2016-04-08 Thread jmh530 via Digitalmars-d-learn
On Friday, 8 April 2016 at 20:58:46 UTC, Ali Çehreli wrote: And yes, functions can return tuples: :) I was getting that same error recently, but I forgot what was causing it. He mentions AliasSeq above, could the error be referring to compile time argument lists?

Re: simple range question

2016-04-08 Thread jmh530 via Digitalmars-d-learn
On Friday, 8 April 2016 at 18:27:59 UTC, Laeeth Isharc wrote: suppose I have a forward or random access range. what's the best way to compare each element with the element 4 elements prior to that element? I could map each element to a tuple of the element and the element 4 bars previously

Re: In language tooling

2016-03-04 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 2 March 2016 at 02:36:50 UTC, Charles wrote: is this something that could be accomplished in D with CTFE? I think I've heard him say that tools should be part of the language. However, I haven't watched that video and anyway am not sure how important CTFE would be to this

Re: Issue Turning Template into Variadic Template

2016-03-31 Thread jmh530 via Digitalmars-d-learn
On Thursday, 31 March 2016 at 10:27:41 UTC, Artur Skawina wrote: auto mixedCartesianProduct(T...)(T x) { import std.range, std.algorithm : cartesianProduct; return mixin(`cartesianProduct(`~iota(T.length).map!`"conditionalOnly(x["~text(a)~"])"`().join(",")~`)`); }

Re: De Facto standard for D programming language

2016-04-15 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 April 2016 at 17:51:41 UTC, Napster wrote: I would like to start learning the De Facto standard. which book or document would you use? http://erdani.com/index.php/books/tdpl/ or https://dlang.org/spec/intro.html which one would you call de facto standard? If I were learning

Re: De Facto standard for D programming language

2016-04-15 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 April 2016 at 18:41:23 UTC, Ali Çehreli wrote: Having said that, there are some omissions of how some features interact. I think it is a fantastic resource and have made much use out of it. I hope you keep updating it. It just happens that there are always some random

Re: How to run unit tests on Windows?

2016-04-14 Thread jmh530 via Digitalmars-d-learn
On Thursday, 14 April 2016 at 11:43:42 UTC, pineapple wrote: I'm haven't got access to my Windows PC at the moment, but that sounds like it will solve my problem. Thank you! Also, you can use rdmd on Windows if dmd is installed.

Re: Variadic Tuple of Structs with Mixed Types

2016-07-18 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 July 2016 at 19:24:12 UTC, jmh530 wrote: Have you considered recursive solutions? Will try that next. Thanks. I think this worked for me. A few tricks were that I had to have the fillAliasSeq template as global and also I couldn't disable the default constructor for what I

Passing a single tuple or multiple values

2016-07-18 Thread jmh530 via Digitalmars-d-learn
In the code below, is it possible to combine both bar functions into one function (I just put some random foo function to get it to work)? When I try to do it, I get errors that no property 'expand' for type '(Tuple!(int, int))' I think it has something to do with T... being considered a

Re: Passing a single tuple or multiple values

2016-07-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 July 2016 at 07:23:52 UTC, John wrote: auto bar(T...)(T x) { static if (T.length == 1 && isTuple!(T[0])) return foo(x.expand); else return foo(x); } Hmm, this actually doesn't seem to be resolving my issue. I'm still getting the error about not being able to

Re: Passing a single tuple or multiple values

2016-07-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 July 2016 at 07:23:52 UTC, John wrote: auto bar(T...)(T x) { static if (T.length == 1 && isTuple!(T[0])) return foo(x.expand); else return foo(x); } void main() { auto x = tuple(1, 2); auto y = bar(x); auto z = bar(x.expand);

Re: Passing a single tuple or multiple values

2016-07-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 July 2016 at 15:40:20 UTC, Lodovico Giaretta wrote: You can find this out from the error, which says that you can't expand an object of type `(Tuple!(int, int))`. Note the surrounding parenthesis: they tell you that what you have is not a Tuple, but an AliasSeq whose only

Re: Variadic Tuple of Structs with Mixed Types

2016-07-15 Thread jmh530 via Digitalmars-d-learn
On Saturday, 9 July 2016 at 05:40:10 UTC, ag0aep6g wrote: On 07/09/2016 12:33 AM, jmh530 wrote: I'm trying to create a tuple of variadic length containing structs with mixed types. So for instance, given struct Foo(T, U) { T x; U y; } I want to create something like

Re: Variadic Tuple of Structs with Mixed Types

2016-07-15 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 July 2016 at 17:41:21 UTC, Michael Coulombe wrote: Your issue is this line: alias boxAR(A) = Box!(A, R); This means that A must be a type, but you are trying to instantiate it with lambdas. If you switch to: alias boxAR(alias A) = Box!(A, R); But now you are back to the

Variadic Tuple of Structs with Mixed Types

2016-07-08 Thread jmh530 via Digitalmars-d-learn
I'm trying to create a tuple of variadic length containing structs with mixed types. So for instance, given struct Foo(T, U) { T x; U y; } I want to create something like Tuple!(Foo!(type1, type2), Foo!(type1, type3), ..., Foo!(type1, typeN)) x; The bar function (below) is

Re: Variadic Tuple of Structs with Mixed Types

2016-07-09 Thread jmh530 via Digitalmars-d-learn
On Saturday, 9 July 2016 at 05:40:10 UTC, ag0aep6g wrote: template bar(T, U...) if (U.length > 1) { import std.meta : staticMap; import std.typecons : Tuple; alias baz(A) = Tuple!(T, A); alias V = staticMap!(baz, U); alias TupleToFoo(T : Tuple!(Types), Types ...) =

Re: Diff between function and delegate

2016-06-29 Thread jmh530 via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:59:05 UTC, Mathias Lang wrote: Delegate don't GC allocate when: - You take a pointer to a member function - The function accept a `scope` delegate and you pass a literal - You use `scope myDG = (Params) { body... }` I have a somewhat related question. Why use a

IFTI in Eponymous Templates

2016-06-29 Thread jmh530 via Digitalmars-d-learn
I was playing around with some Eponymous Templates. I had been under the impression that Implicit Function-Template Instantiation (IFTI) meant that you don't have to explicitly instantiate all functions. However, it seems like there are cases with eponymous templates with functions in them

Re: IFTI in Eponymous Templates

2016-06-29 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 21:38:23 UTC, ag0aep6g wrote: You're explicitly instantiating the outer bar there, not the inner one. Yes, you're correct. I mixed up the inner/outer. I just thought it was something weird I had noticed.

Getting familiar with std.process

2017-02-09 Thread jmh530 via Digitalmars-d-learn
I haven't used std.process before and am trying to play around with it. In the code below, the first file writes some text to an output file. My goal is to be able to read what is written to that file without creating the file itself. I'm not sure it's possible, but the second file is my

Re: Getting familiar with std.process

2017-02-09 Thread jmh530 via Digitalmars-d-learn
On Thursday, 9 February 2017 at 21:36:46 UTC, Ali Çehreli wrote: On 02/09/2017 12:44 PM, jmh530 wrote: > I think the issue is that create_file doesn't write to stdout, it writes > to file. Correct. Pipe works by piping the standard input/output streams. > Other than reading the file and then

Re: Templates problem

2016-09-08 Thread jmh530 via Digitalmars-d-learn
On Thursday, 8 September 2016 at 10:18:36 UTC, Russel Winder wrote: I am certainly hoping that Chapel will be the language to displace NumPy for serious computation in the Python-sphere. Given it's foundation in the PGAS model, it has all the parallelism needs, both cluster and local, built

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 11:37:44 UTC, Russel Winder wrote: I really don't see what's not working in this. Trying to get new D users from Python users is the main problem. I came to D from Python/R/Matlab. The biggest issue for me wasn't error messages so much as the lack of

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 19:19:23 UTC, data pulverizer wrote: For some time I have been considering a problem to do with creating tables with unbounded types, one of the failed attempts is here: https://forum.dlang.org/thread/gdjaoxypicsxlfvzw...@forum.dlang.org?page=1 I then

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 20:49:42 UTC, data pulverizer wrote: You're quite right that D doesn't need to change at all to implement something like pandas or dataframes in R, but I am thinking of how to got further. Very often in data science applications types will turn up that are

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 18:55:41 UTC, pineapple wrote: So the first difference you're likely to notice is that it's not as well documented. (Sorry. I'm a busy woman. I'll get around to it.) I try to make up for it with copious unit tests, which should provide a good example for how

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:33:25 UTC, pineapple wrote: Fuck it, I took an hour to document the most significant modules. https://github.com/pineapplemachine/mach.d/tree/master/mach/range Looks like a step in the right direction!

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 21:41:20 UTC, data pulverizer wrote: Yes, but from a usability point of view this would be very poor - forcing the user to create a new variable each time they modified a table. I am aware that databases do this but it is hidden away. To be fair, you can

Re: Templates problem

2016-09-09 Thread jmh530 via Digitalmars-d-learn
On Friday, 9 September 2016 at 13:24:18 UTC, Russel Winder wrote: For computational work I'd say Chapel was just as productive as any other language, probably better. This is though likely an issue on which there is only opinion and no facts. GPGPU support is not in Chapel as yet I believe,

Re: Templates problem

2016-09-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote: You might want to check out the ranges package of the library I'm working on. https://github.com/pineapplemachine/mach.d/tree/master/mach/range There's a lot of stuff there. Do you mind giving a TL;DR version of what your

Re: pow exponent type issue

2016-08-24 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 24 August 2016 at 19:41:35 UTC, ag0aep6g wrote: -y1 is -1. But -y2 is uint.max, i.e. a pretty large positive number. The 'u' in "uint" stands for "unsigned". That is, it doesn't know negative numbers. Dont' use uint when you need negative numbers. Ahh, doh.

pow exponent type issue

2016-08-24 Thread jmh530 via Digitalmars-d-learn
I'm a little confused on why pow behaves so differently when switching from an int to a uint for the exponent. import std.math : pow; import std.stdio : writeln; void main() { float x = 2; int y1 = 1; uint y2 = 1; writeln(pow(x, -y1)); //prints 0.5

Template mixins and selective imports

2017-08-03 Thread jmh530 via Digitalmars-d-learn
I am trying to create a vectorize function that mixes in a new version of function with the same name that applies the function (to an ndslice). The code below compiles without error and has the behavior I would expect. However, when I change the function import to a selective import (e.g.

Re: Template mixins and selective imports

2017-08-03 Thread jmh530 via Digitalmars-d-learn
On Thursday, 3 August 2017 at 19:05:47 UTC, Meta wrote: On Thursday, 3 August 2017 at 19:03:55 UTC, Meta wrote: `mixin vectorize!sin vsin; alias sin = vsin;` and see if it Should be `alias sin = vsin.sin;` Thanks, this pointed me in the right direction. I got the line below working.

Re: Relative lflag paths in dub on Windows

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 00:22:56 UTC, Mike Parker wrote: On Wednesday, 28 June 2017 at 00:16:23 UTC, Mike Parker wrote: On Tuesday, 27 June 2017 at 19:07:49 UTC, You have to specify the appropriate linker option, e.g. -L-option. For gcc, that happens to -L, so you get -L-L. For optlink

dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
I am behind a corporate firewall at work so I have to manually install dub packages. This requires setting the version manually, otherwise master is inferred. This was working great until I had ended a dub run command early. Now dub seems to have forgotten that the versions are in there. It's

Re: dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 19:54:01 UTC, jmh530 wrote: [snip] Does not seem to be a problem for another project using dub with dmd and similar dependencies...

Re: dub seems to have forgotten my versions

2017-06-29 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 21:25:18 UTC, jmh530 wrote: On Wednesday, 28 June 2017 at 20:18:20 UTC, jmh530 wrote: On Wednesday, 28 June 2017 at 19:54:01 UTC, jmh530 wrote: [snip] Does not seem to be a problem for another project using dub with dmd and similar dependencies... After

Re: dub seems to have forgotten my versions

2017-06-28 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 20:18:20 UTC, jmh530 wrote: On Wednesday, 28 June 2017 at 19:54:01 UTC, jmh530 wrote: [snip] Does not seem to be a problem for another project using dub with dmd and similar dependencies... After spending some time looking through the dub issues, I found that

Relative lflag paths in dub on Windows

2017-06-27 Thread jmh530 via Digitalmars-d-learn
Is it possible to set relative -L paths on dub for Windows? Absolute paths work fine, just can't get relative paths working. I was looking at the thread here https://forum.dlang.org/post/dkwqrwzwqbrnaamlv...@forum.dlang.org and came up with something like { ... "lflags":

Re: using DCompute

2017-07-27 Thread jmh530 via Digitalmars-d-learn
On Friday, 28 July 2017 at 01:30:58 UTC, Nicholas Wilson wrote: Yes, although I'll have to add an attribute shim layer for the dcompute druntime symbols to be accessible for DMD. When you compile LDC will produce .ptx and .spv files in the object file directory which will be able to be used

Re: Issue with template constraints in numeric types

2017-08-04 Thread jmh530 via Digitalmars-d-learn
On Thursday, 3 August 2017 at 12:49:48 UTC, data pulverizer wrote: Hmm ... it looks as the specialization `:` operator is working like the constraint `:` operator and doing convertible at least for the floating point case. Is that right? They're both doing the same thing as far as I know.

Type Inference in @safe unittests

2017-08-22 Thread jmh530 via Digitalmars-d-learn
I'm not sure if this is a bug or not. I was playing around with printing out some member types with unittests and I was noticing some strange results when they were in @safe unittests rather than normal unittests. The first one prints out what I would expect, but the @safe unittest puts @safe

Re: std.format expand "%s"

2017-08-22 Thread jmh530 via Digitalmars-d-learn
On Monday, 21 August 2017 at 15:39:04 UTC, Steven Schveighoffer wrote: What I mean is that %s goes to %d for isIntegral!(typeof(x)), and %s goes to %g for isFloatingPoint!(typeof(x)), and stays as %s for everything else. Given this, you could probably write the function you were looking

std.format expand "%s"

2017-08-20 Thread jmh530 via Digitalmars-d-learn
I'm playing around with std.format and I'm trying to figure out if there is any way to identify what "%s" should expand to. So for instance: int x = 1; auto result = x.format!"%s"; I would know that result="1". I could run "1" through unformatValue and get back 1. I'm looking to see if there

Re: Type Inference in @safe unittests

2017-08-22 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 16:27:05 UTC, Jonathan M Davis wrote: Well, templates aren't the only case where we have attribute inference anymore (e.g. auto return functions have it), and I'm pretty sure that there have been several requests for fixing issues regards to local declarations

Re: Type Inference in @safe unittests

2017-08-22 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 18:25:31 UTC, Steven Schveighoffer wrote: @safe void main() { struct Foo { int foo(int i, string s) @safe { return 0; } double foo2(string s) @safe { return 0; } } printMemberTypes!(Foo); } The surprising part to me is that

Re: BetterC and TypeInfo Question

2017-06-22 Thread jmh530 via Digitalmars-d-learn
On Thursday, 22 June 2017 at 14:50:45 UTC, Adam D. Ruppe wrote: [snip] I appreciate the reply.

BetterC and TypeInfo Question

2017-06-22 Thread jmh530 via Digitalmars-d-learn
I should preface this by saying I don't really have a good sense of how either BetterC or the D runtime work. The recent BetterC thread made me wonder about TypeInfo in the D runtime. My (surface level) understanding is that this is what makes typeid work at run time. I was looking through

Re: Mutiple AliasSeq as input to template

2017-05-25 Thread jmh530 via Digitalmars-d-learn
On Thursday, 25 May 2017 at 16:36:45 UTC, jmh530 wrote: [snip] I haven't played around with it fully, but it seems like the following resolves my issue in a sort of manual way: template Process1(A, B) { static if (!isIndex!B) alias Process1 = A; else

Re: D scripting in D

2017-06-02 Thread jmh530 via Digitalmars-d-learn
On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote: I wonder if it is possible to somehow turn D in to a scripting language that can be run inside D? The point? To have the same uniform syntax for quickly developing scripts that can then be easily transferred, if desired, in to a

Re: Changing Template Static Ifs to Recursion

2017-06-01 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 21:02:07 UTC, jmh530 wrote: On Wednesday, 31 May 2017 at 19:22:18 UTC, Stefan Koch wrote: You could also use string mixins. Which will be more efficient then recursion. I try to avoid string mixins unless I can't help it. Nevertheless, I made an effort to try to

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 19:25:22 UTC, ag0aep6g wrote: On 05/31/2017 08:50 PM, jmh530 wrote: Note: I left out the function foo, but think of foo is to Foo as tuple is to Tuple. You should have included foo, in my opinion. I'm having trouble figuring out what your code does. `process`

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 19:22:18 UTC, Stefan Koch wrote: You could also use string mixins. Which will be more efficient then recursion. I try to avoid string mixins unless I can't help it. Nevertheless, I made an effort to try to get it to work and below seems to be working. I still

Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
I have a struct that I am using like a Tuple, but I want to be able to opIndex in a different way than Tuple's opIndex. I want to be able to opIndex whatever is underlying the Tuple. The code below works, but is kind of annoying because to extend you have to keep adding static ifs. I want to

Re: Mutiple AliasSeq as input to template

2017-06-08 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 19:03:39 UTC, David Sanders wrote: You can use nested templates to process multiple AliasSeqs like so: [snip] Interesting approach also.

Static Initialization of Struct as UDA

2017-06-13 Thread jmh530 via Digitalmars-d-learn
The code below doesn't compile because "static variable z cannot be read at compile time". However, z is a static variable, so I don't see why it wouldn't be available at compile-time. Bug or am I missing something? struct Bar { int x = 2; int y; } static Bar z = {y:1}; void main()

Re: Static Initialization of Struct as UDA

2017-06-13 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 13 June 2017 at 22:16:37 UTC, ag0aep6g wrote: No bug. `static` has no effect on module-level variables. `z` is a normal mutable variable, not at all guaranteed to be constant. Make it an `enum` or `immutable`. Note that immutable doesn't guarantee compile-time constancy,

Mutiple AliasSeq as input to template

2017-05-25 Thread jmh530 via Digitalmars-d-learn
I'm trying to process one AliasSeq based on the types in another. I've tried to sketch it out below. However, it doesn't work because when you combine together two AliasSeq's in the template, then it creates one AliasSeq. The only other thing I considered was a staticMap with isIndex, but I

Re: Override with function overloads

2017-09-11 Thread jmh530 via Digitalmars-d-learn
On Monday, 11 September 2017 at 20:40:30 UTC, nkm1 wrote: I don't know, maybe don't use alias this :) IMO, it's a really dubious feature... I don't think it's an issue of alias this, per se. I think it's just something to be aware of and use your approach of aliasing as necessary. It's

Re: extern(C) enum

2017-09-15 Thread jmh530 via Digitalmars-d-learn
On Friday, 15 September 2017 at 18:20:06 UTC, Jonathan M Davis wrote: It is my understanding that for both C and C++, an enum is always an int (unless you're talking about enum classes in C++). The size of an int can change based on your architecture, but AFAIK, all of the architectures

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread jmh530 via Digitalmars-d-learn
On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up your experience with doing it as either blog post or part of

Re: What the hell is wrong with D?

2017-09-19 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 02:36:50 UTC, Jonathan M Davis wrote: Please try to be civil. It's fine if you're unhappy about some aspect of how D works and want to discuss it, but we do not condone personal attacks here. - Jonathan M Davis He seemed to be threatening the guy's life

Re: What the hell is wrong with D?

2017-09-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:16:05 UTC, EntangledQuanta wrote: ()?: is not ambiguous! The D community preaches all this safety shit but when it comes down to it they don't seem to really care(look at the other responses like like "Hey, C does it" or "Hey, look up the operator

Re: What the hell is wrong with D?

2017-09-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 20:00:40 UTC, Brad Anderson wrote: If you want to help, I suggest trying to come up with a DIP that addresses it while being conscious of how to avoid breaking an enormous amount of code. I suspect it's a hard and maybe impossible problem but if you are up

Basic LDC Linux Install Question

2017-09-19 Thread jmh530 via Digitalmars-d-learn
I'm more of a Windows user than a Linux user. I have the latest DMD on my Linux install (linux mint 17.3), but I wanted to test LDC. I get a message that ldc2 is not found when I type ldc2 --version or sudo ldc2 --version (I'm not on root and the existing user does not have root privileges,

Re: Basic LDC Linux Install Question

2017-09-19 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 12:37:12 UTC, Daniel Kozak wrote: Yes you need to add ldc2 to your PATH. So if your ldc2 binary is in /user/something/something/folder_where_is_ldc2/ldc2 you havto add /user/something/something/folder_where_is_ldc2 to your PATH. You can test this by pasting

Re: wstring hex literals

2017-09-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 16:26:46 UTC, Neia Neutuladh wrote: On Wednesday, 20 September 2017 at 15:04:08 UTC, jmh530 wrote: testing_utf16.d(5): Error: Truncated UTF-8 sequence testing_utf16.d(6):while evaluating: static assert((_error_) == (wstring )) Failed: ["dmd",

wstring hex literals

2017-09-20 Thread jmh530 via Digitalmars-d-learn
I don't seem to be having any issues making strings or dstrings from hex, but I run into some issues with wstrings. Of course, my knowledge of UTF-16 is limited, but I don't see any issues with the code below and I get some errors on the hex string literal. unittest { wchar data = 0x03C0;

Re: [OT] Converting booleans to numbers

2017-09-20 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 19:25:58 UTC, Timon Gehr wrote: On 19.09.2017 23:17, nkm1 wrote: ... OTOH, booleans converting to numbers is a very questionable feature. > I certainly have never seen any good use for it. ... Actually, it is useful enough to have a Wikipedia page:

<    1   2   3   4   5   >