Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-19 10:56, Jacob Carlborg wrote: The makefile isn't updated, see [1]. Trying adding "STABLE_DMD_VER=2.067.0" to the command you're running. Pull request: https://github.com/D-Programming-Language/dlang.org/pull/968 -- /Jacob Carlborg

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-19 18:20, Gary Willoughby wrote: Here are the errors: ... touch ../dub-0.9.23/.cloned mkdir -p /tmp/.stable_dmd-2.067.0 TMPFILE=$(mktemp deleteme.) && curl -fsSL http://downloads.dlang.org/releases/2.x/2.067.0/dmd.2.067.0.linux.zip > ${TMPFILE}.zip && \ unzip -qd /tm

Re: Building website from git master, why does it checkout DMD v2.066.1 and die?

2015-04-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-20 12:42, Gary Willoughby wrote: Great thanks that cured the linking problem but there are still more errors during the build. I'm giving up for now as i only need the html but it's disappointing that it's so broken. Are your clones of DMD, druntime and Phobos up to date and clean?

Re: Converting Java code to D

2015-04-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-20 20:05, Steven Schveighoffer wrote: enum LineStyle : string { NONE = "None", SOLID = "Solid", ... // etc } Used like this: funcThatTakesString(LineStyle.NONE); LineStyle ls = LineStyle.SOLID; funcThatTakesLineStyle(ls); I'm not a Java programmer, and my time with Ja

Re: Structural exhaustive matching

2015-04-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-21 17:36, Jadbox wrote: What's the best equivalent to Rust's structural enum/pattern (match)ing? Is it also possible to enforce exhaustive matches? Basically, I'm curious on what the best way to do ADTs in D. There's something call "castSwitch" [1], perhaps not what you're looking f

Re: Weird OSX issue

2015-04-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-24 20:37, Steven Schveighoffer wrote: So am I going crazy? Or is dmd doing things differently depending on where its environment is? Any compiler gurus out there understand why the symbol is different? I don't want to file a bug with this, because it seems dependent on installation l

Re: [dvm] Can't install compilers on Mac

2015-04-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-28 19:46, Chris wrote: I keep getting this message. Why? Fetching: http://ftp.digitalmars.com/dmd.2.067.0.zip [>] 56256/54884 KB Installing: dmd-2.067.0 An unknown error occurred: tango.core.Exception.IOException@/Users/doob/development/d/tango

Re: [dvm] Can't install compilers on Mac

2015-04-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-29 23:24, Chris wrote: Yes. Doesn't work. What happens when you run "./dvm install dvm"? What is the output? If the installation of DVM itself fails you will not be able to install compilers. You can verify the installation of DVM by opening a new shell session (a new tab or wi

Re: Linking to Dynamic Library on Mac OS X

2015-05-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-05-15 21:49, John Colvin wrote: Note that you may also find you need to help OS X find the dylib when running the program, either by moving it to one of the system locations or using DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH That should not be necessary. -- /Jacob Carlborg

Re: deserialization: creating a class instance without calling constructor

2015-05-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-05-21 11:06, Timothee Cour via Digitalmars-d-learn wrote: Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class without default constructor for example (it knows what the fields s

Re: Is there a way to get the types of all template parameters?

2015-06-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-04 15:38, Atila Neves wrote: For regular runtime parameters, there's ParameterTypeTuple. How would I write an equivalent template for template parameters? i.e. void fun(Foo foo, Bar bar)() {} alias types = CtParameterTypeTuple!fun; //TypeTuple!(Foo, Bar) I've tried but my

Re: Initialising global associative array

2015-06-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-06 20:18, Paul wrote: I need a globally accessible AA of type string[string] and find that it won't compile unless I use the static this(){} method as described in this thread: http://forum.dlang.org/thread/owhfdwrpfuiehzpiu...@forum.dlang.org#post-mailman.1522.1346449072.31962.digita

Re: What is D's minimum requirements on Mac?

2015-06-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-11 13:34, Kagamin wrote: You can try to register as a developer: https://developer.apple.com/programs/ and get beta versions of OSX and install them on virtual box. Not sure how much it costs. OS X is free, you just need a Mac to download it :) -- /Jacob Carlborg

Re: What is D's minimum requirements on Mac?

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-10 20:55, Adam D. Ruppe wrote: i'm considering something like http://www.amazon.com/Apple-MB138LL-Intel-Drive-Combo/dp/B0006HU49Y/ref=sr_1_5?ie=UTF8&qid=1433962021&sr=8-5&keywords=used+mac+mini You can look up the requirements for OS X and see which is the latest version you can ru

Re: What is D's minimum requirements on Mac?

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-06-10 20:55, Adam D. Ruppe wrote: I'm still tempted to grab a used Mac so I can port my display stuff to Cocoa and test it, but Macs are outrageously expensive and I hate them, so want to spend as little as possible. What does dmd minimally require on a mac? If I got like a 10.5 would th

Re: Exec function D from C++

2015-06-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 21/06/15 16:09, Sean Campbell wrote: extern(C++) void d_initialize() { Runtime.initialize(); } extern(C++) void d_terminate() { Runtime.terminate(); } These two functions are not necessary. There are already functions in druntime which are supposed to be called from C/C++: ex

Re: proper way to calculate toHash() for string

2015-06-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 30/06/15 16:19, aki wrote: Please suggest me if anyone have an idea. You can use TypeInfo.getHash [1] to get the hash of a given value. Something like: string a = "foo"; typeid(a).getHash(&a) [1] http://dlang.org/phobos/object.html#.TypeInfo.getHash -- /Jacob Carlborg

Re: Binding Nested C Structs

2015-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-10 05:38, Craig Dillabaugh wrote: I am trying to bind to a C union with a number of nested structs declared as follows: typedef union { int Integer; struct { int nCount; int *paList; } IntegerList; struct { int nCoun

Re: Covariant callback functions, or assigning base class members through a subclass reference

2015-07-14 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-14 17:28, Rene Zwanenburg wrote: Given the following code: class Base { alias CallbackType = void delegate(Base); CallbackType callback; void foo() { callback(this); } } class Derived : Base { } void main() { auto d = new Derived(); d.c

Re: Covariant callback functions, or assigning base class members through a subclass reference

2015-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-14 17:53, Rene Zwanenburg wrote: Sure, but that would make Base!Derived and Base!AnotherSubClass different types. What I'd like to end up with is a Base[], being able to call foo() on the array members. Other parts of the code will add instances of derived types to this array, and ha

Re: Template function that accept strings and array of strings

2015-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-15 23:57, badlink wrote: Hello, I can't figure how to write a template function that accept either strings or array of strings. This is my current code: bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId) if (is(typeof(T) == char) || (isArray!T && is(typeof(T[]) == char)

Re: Weird behavior of "this" in a subclass, I think?

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-16 09:46, Jonathan M Davis via Digitalmars-d-learn wrote: I've never heard of a language that overloaded member variables, and given how class polymorphism works, I don't see how it would even be possible without making it so that all accesses to a variable actually call a function to

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-17 09:33, Anonymous wrote: So for a software named 'SuperDownloader2015' it would be $HOME/Library/Application Support/SuperDownloader2015 right ? so it's not user-specific and it's writable for the current user ? sorry but it looks a bit strange, anyone can confirm ? Yes, that'

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-16 23:12, anonymous wrote: I have the following code, working under Win and Linux: --- import std.process: environment; immutable string p; static this() { version(Win32) p = environment.get("APPDATA"); version(linux) p = "/home/" ~ environment.get("USER"); version(OS

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-17 09:14, FreeSlave wrote: Hello. You may take a look at this library https://github.com/MyLittleRobo/standardpaths OSX version uses Carbon though. You may want to use Cocoa API (which is newer), but it's Objective-C. DMD master now has some initial support for Objective-C. -- /Jac

Re: Template function that accept strings and array of strings

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-16 18:49, badlink wrote: The method with the variadic function works, but I would have to use only one parameter because this doesn't work: fun(const(char[])[] a, const(char[])[] b ...) and is a bit ugly in my use case ... I don't think I really understand how you want to use/call t

Re: How to convert byte array to float

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-17 20:58, byron wrote: Ah I miss read, if you want as a float, not a float array you can do: byte[] b = [1, 2, 3, 4]; float f = *cast(float*)b.ptr; not sure if there is a better way I think a union can be used as well, not sure if it's better though. -- /Jacob Carlborg

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-17 15:27, anonymous wrote: Ok so my sample can be rewritten static this() { version(Win32) p = environment.get("APPDATA"); version(linux) p = "/home/" ~ environment.get("USER"); version(OSX) p = environment.get("HOME") ~ /Library/Application Support/; } --- I

Re: Template function that accept strings and array of strings

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-17 19:25, badlink wrote: My fault, I didn't test the variadic function enough and jumped to conclusion. It actually works well http://pastebin.com/R4EHuBLh Cool :) Sometimes D developers think templates will be needed to solve everything. -- /Jacob Carlborg

Re: C bindings: typedef struct conflicts with method

2015-07-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-21 07:53, yawniek wrote: i tried to automagically create bindings for librdkafka (https://github.com/edenhill/librdkafka) with dstep. now the code contains typedefs structs with the same name as methods: ``` typedef struct rd_kafka_metadata { int broker_cnt; /* N

Re: C bindings: typedef struct conflicts with method

2015-07-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-21 14:24, yawniek wrote: done, https://github.com/jacob-carlborg/dstep/issues/40 i was under the impression that there is already a ticked as https://github.com/jacob-carlborg/dstep/issues/8 looks very similar (but was closed). Yeah, looks very similar. Issue 8 i still open and has

Re: C bindings: typedef struct conflicts with method

2015-07-22 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-23 03:57, Mike Parker wrote: In your case, rd_kafka_metadata is the name of the struct, but in C instances would need to be declared like so: struct rd_kafka_metadata instance; Since the struct is declared directly in the typedef, is the struct name actually available? -- /Jacob

Re: Getting "this" to work similar to "self" in Python

2015-07-22 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-23 00:22, nurfz wrote: I think you got overly complicated answers. I guess I'm confused as to why the D code isn't acting similar to the Python code in the sense that you would expect "this" to reference the "speed" property of the current instance and not statically reference the pa

Re: How does __traits and std.traits differ?

2015-07-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-24 09:16, WhatMeWorry wrote: Looking at the online documentation, it says: __traits "are extensions to the language to enable programs, at compile time, to get at information internal to the compiler." std.traits are "Templates which extract information about types and symbols at co

Re: extern(C) with function returning user type

2015-07-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-07-29 20:42, Kyoji Klyden wrote: Thanks for the replies, This issue really highlights one of D's weak points I think. I've atleast got a round about solution almost working. :P You might want to check out Calypso [1] as well. [1] http://forum.dlang.org/thread/nsjafpymezlqdknmn...@fo

Re: Empty struct, any runtime cost?

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-19 16:05, Nicholas Wilson wrote: I'd be surprised if it didn't, but you can always check the disassembly. If for some reason either the compiler doesn't remove it (it never removes classes btw but not sure about structs) or the linker doesn't discard it you can try -gcsections ( or w/

Re: automatically verifying code samples in phobos docs

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-20 01:41, Laeeth Isharc wrote: Should this be done? How? Just use a documented unit tests block: /// unittest { // code goes here } It will be run as part of the unit tests and it will be included when generating the documentation. Although I don't have a good solution for

Re: automatically verifying code samples in phobos docs

2015-08-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-20 10:49, wobbles wrote: Will AutoProtocol().idup not make this work? Make an immutable copy of whatever AutoProtocol() returns, which should be then immutable char[] (i.e. string) Yes, that should work. -- /Jacob Carlborg

Re: A better way than foreach with this?

2015-08-23 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-24 07:58, Joel wrote: auto names = "Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf " "Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe " "Pe Final_Tsadi Tsadi Qof Resh Shin Tav".split; foreach (ref name; names)

Re: (De)Serializing interfaces

2015-08-23 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-22 21:14, nims wrote: Using Orange all I got was a lot of compiler errors. Seems I completely overlooked interfaces. I'll see if I can add support for them. -- /Jacob Carlborg

Class info on interfaces

2015-08-26 Thread Jacob Carlborg via Digitalmars-d-learn
I noticed the calling "classinfo" on an interface returns the class info of the static type and not the dynamic type. Is that intentional? Perhaps because of COM and C++ interfaces? module main; import std.stdio; interface Foo {} class Bar : Foo {} void main() { Foo f = new Bar; writ

Re: Class info on interfaces

2015-08-27 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-26 20:59, Adam D. Ruppe wrote: Yes, exactly. COM and C++ things won't necessarily have a D TypeInfo available and since interfaces can be them, it can't be sure. What I do there is to just cast the interface to Object. Then you should check for null to cover those cases, then you can

Re: (De)Serializing interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-22 21:14, nims wrote: I think interfaces are very powerful and I heavily use them. The only problem I have with them is that serializing/deserializing them to XML or JSON doesn't seem to work. So far I got to try Orange and painlessjson. Using Orange all I got was a lot of compiler err

Re: Class info on interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-28 17:41, rumbu wrote: I don't know about Objective-C, but: - for native D interfaces __traits(getVirtualIndex, NativeInterface.firstFunction) == 1 since the first entry in vtbl is the contained object - for C++ interfaces __traits(getVirtualIndex, CPPInterface.firstFunction) == 0 -

Re: Class info on interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-28 16:31, Adam D. Ruppe wrote: Not fully, no, but you might be able to reflect into the methods and see what kind of linkage they have. http://dlang.org/phobos/std_traits.html#functionLinkage That might work. However, you can't do anything with an interface that isn't in there an

Re: Class info on interfaces

2015-08-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-08-28 22:40, rumbu wrote: The linkage check it's good as long you don't have an abomination like this: extern(C++) interface CPPInterface { extern(D) void foo(); } Good point. Anyway, the problem is the availability of such function. If the interface doesn't contain any functio

Re: Working Windows GUI library?

2015-09-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-03 17:46, Andre Polykanine via Digitalmars-d-learn wrote: Hi everyone, Does anyone of you work with a Windows GUI library with native controls in order to write desktop apps in D? Here is why I'm asking: actually, there are quite a number of GUI libraries listed at wiki.dl

Re: Chaining struct method invocations

2015-09-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-07 16:44, Bahman Movaqar wrote: Does this mean that in the following piece of code, what is passed to `add` is actually a copy of `rec1`? auto rec1 = SalesRecord("p10", 1.0, 10); coll.add(rec1); Yes. structs have value semantics. If you want reference semantics you might w

Re: C++ Interop -- Two Questions

2015-09-09 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-09 11:55, Mike Parker wrote: Given a C++ class that looks like this: class Foo { static void Initialize(const SomeObject&); virtual void func1(); } The documentation at [1] doesn't say anything about how to handle static member functions like Initialize, nor do I see anythin

Re: Calling D from C, C++, Python…

2015-09-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-10 20:01, Russel Winder via Digitalmars-d-learn wrote: Is there an easy way of knowing when you do not have to initialize the D runtime system to call D code from, in this case, Python via a C adapter? You always need to initialize the D runtime, unless you have a D main function. Y

Re: Calling D from C, C++, Python…

2015-09-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-12 10:56, Russel Winder via Digitalmars-d-learn wrote: I have a small D function (C linkage) compiled to a shared object that I am calling from Python via CFFI that works fine with no D runtime initialization. Thus I have experimental evidence "always" is not entirely the case! I real

Re: Calling D from C, C++, Python…

2015-09-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-13 12:10, Jakob Ovrum wrote: On Linux and other ELF-using platforms, initialization and deinitialization functions could be placed in the .init and .deinit special sections, but I don't know if druntime has any convenient provisions for this. With GDC and LDC you can probably use a pr

Re: Why do abstract class functions require definitions?

2015-09-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-16 10:49, FiveNights wrote: Every so often I'll get a compiler error that isn't particularly clear on what's wrong and eventually I'll figure out that what's causing it is having a function in an abstract class somewhere that isn't defined: abstract class SomeClass { int someVari

Re: Why do abstract class functions require definitions?

2015-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-16 12:36, Marc Schütz wrote: Wouldn't the following behaviour be more useful as a default? abstract class Foo { void bar1() { } // non-abstract, obviously void bar2();// abstract, because it's in an abstract class // (di

Re: Why do abstract class functions require definitions?

2015-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-18 17:45, Jakob Ovrum wrote: That's `export`. Right, my bad. D has too many attributes :) -- /Jacob Carlborg

Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
I have a library that needs to check if a type is a typedef. Something like: static if (is(T == typedef)) But now typedef is deprecated or even removed. I want my library to compile with the latest version of DMD without any deprecation warnings but at the same time be backwards compatible. Wh

Re: Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-20 13:17, Martin Krejcirik wrote: __VERSION__ ? Will only solve identifying if a feature is supported or not. When the features is actually used a string mixin will still be required, as far as I know. -- /Jacob Carlborg

Re: OS minimum version

2015-09-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-21 14:47, ponce wrote: 1. What is the minimum Windows version required by programs created with DMD? 2. What is the minimum Windows version required by programs created with LDC? I'm guessing Windows XP for both LDC and DMD. Windows is pretty good at backwards compatibility. 3.

Re: Tutorial on C++ Integration?

2015-09-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-28 09:08, Mike McKee wrote: I'm using Qt/C++ on a Mac. I want to try my hand at making a dylib in D Dynamic libraries are not officially supported on OS X. -- /Jacob Carlborg

Re: address of overloaded function

2015-10-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-10-01 00:48, Freddy wrote: How do you take the address of a specific overloaded function. This won't compile --- import std.range; void main() { ForwardAssignable!int range; int delegate() @property get = &range.front; void delegate(int) @property set = &range.front; } ---

Re: full path to source file __FILE__

2016-07-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-07-22 04:24, Jonathan Marler wrote: The script depends on other files relative to where it exists on the file system. I couldn't think of a better design to find these files then knowing where the script exists, can you? What kind of files are we talking about. Resource files, config

Re: Transform/Compile to C/CPP as a target

2016-07-23 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-07-23 14:27, ParticlePeter wrote: Is there any kind of project or workflow that converts D (subset) to C/CPP ? No idea about the status but: https://github.com/adamdruppe/tools/blob/dtoh/dtoh.d -- /Jacob Carlborg

Re: q about bindings to C (noob)

2016-08-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-08-03 10:27, RomanZ wrote: version(RefOut) extern(C) void fun(out int input, ref in output); else extern(C) void fun( /*[out]*/ int* input, const(float)* output); version = RefOut; void main() { int input; float output; fun( input, output ); // work fine; is it correc

Re: Library for serialization of data (with cycles) to JSON and binary

2016-08-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 06/08/16 18:11, Neurone wrote: Is there a library that can serialize data (which may contain cycles) into JSON and a binary format that is portable across operating systems? XML: http://code.dlang.org/packages/orange -- /Jacob Carlborg

Ddoc to HTML tool?

2016-08-10 Thread Jacob Carlborg via Digitalmars-d-learn
What's the best way to generate HTML from a snippet of Ddoc? I've extracted the Ddoc from a symbol using DCD and would like to display it in a text editor. Ideally it should be a command line tool. -- /Jacob Carlborg

Re: Ddoc to HTML tool?

2016-08-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 10/08/16 16:48, Kagamin wrote: dmd generates html from dd files; example: https://github.com/dlang/dlang.org/blob/master/download.dd Thanks, I didn't know that. It's not ideal, it adds some other tags that I would like to avoid, i.e. "Page generated by Ddoc", but it works. -- /Jacob Carlb

Re: Ddoc to HTML tool?

2016-08-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 10/08/16 19:10, Adam D. Ruppe wrote: those are in the macro definition file, you can make your own and simplify/improve. I replaced the DDOC macro with my own version, that worked fine. Thanks. -- /Jacob Carlborg

Re: Ddoc to HTML tool?

2016-08-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 10/08/16 16:48, Kagamin wrote: dmd generates html from dd files; example: https://github.com/dlang/dlang.org/blob/master/download.dd Unfortunately it looks like Standard Sections [1] are not handled in the same way as when generating documentation from D source files. They're handled just

Re: Command Line Utility Library

2016-08-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-08-15 09:29, UDW wrote: Hi, I would like some options for a library, preferably json configurable, that helps with command line tool development. Doesn't have to be in D specifically. Currently I am using using std.getopt. I had a search in the DUB repos and in github but didn't really

Re: Command Line Utility Library

2016-08-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-08-16 04:29, Jonathan Marler wrote: Seb how in the heck do you know about all these libraries, geeze. Currently Dub has so few libraries that it's possible to manually scan the list. -- /Jacob Carlborg

Re: Command Line Utility Library

2016-08-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-08-16 11:37, Seb wrote: Manual work? O_o Just open code.dlang.org and either hit CTRL-F or use the search bar (Martin added elastic search two months ago) as the packages usually have a very low PageRank. It's a bit problematic when you don't know what to search for. Not all projects

Re: Get all files imported by a D source file

2016-09-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-08 07:39, Yuxuan Shui wrote: Hi, I wonder if there's standardized way to gather which files are imported by a source file. I know I can run "dmd -v" and look for lines start with "import", but I don't know if this is the best way to do it. You can use the "-deps" flag. -- /Jacob Ca

Re: Get all files imported by a D source file

2016-09-08 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-08 09:20, Yuxuan Shui wrote: -deps is even noisier than just -v... This is what the -deps flag is intended for: -deps print module dependencies (imports/file/version/debug/lib) There's also the -deps= flag, kind of similar: -deps=filename write module dependencies to fi

Re: Get all files imported by a D source file

2016-09-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-09 18:10, Yuxuan Shui wrote: Also the output format seems to change between versions (or between compilers, I don't know). Because dmd 2.071 prefix lines with "depsImport", while ldc (based on dmd 2.070.2) doesn't. The -deps and -deps= will give you different output. See "dmd --he

Help with "cannot alias an expression" compile error

2016-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
I'm trying to do some form of reflection abstraction, here's my sample code: import std.meta; struct Fields(T) { private static alias toField(alias e) = Field!(__traits(identifier, e)); alias fields = staticMap!(toField, T.tupleof); static alias map(alias F) = staticMap!(F, fields

Re: What exactly does the compiler switch -betterC do?

2016-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-19 23:09, Gary Willoughby wrote: $ rdmd --build-only --force -betterC -de -O -inline -release -w test.d $ nm test Indeed. I just noticed now that there's a difference between 2.070.0 and 2.071.0. I get 4 symbols with 2.070.0 and 2428 with 2.071.0. I would say it's a bug. -- /Jac

Re: What exactly does the compiler switch -betterC do?

2016-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-21 02:25, Anonymouse wrote: On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: It is intended to allow you to link an application without druntime. [...] What is the equavilent in gdc and ldc? No idea, try ldc/gdc --help ;) -- /Jacob Carlborg

Re: setting fields of object using traits

2016-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-20 21:45, Ram_B wrote: I'm trying to set fields of object from JSON with traits library. How i can to it properly? import std.stdio; import std.json; import std.traits; import std.meta: Alias; class Obj{ void fromJSON(this T)(JSONValue j){ foreach(field; FieldNameTuple!T

Re: Custom test runner

2016-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-21 07:51, Nick Sabalausky wrote: IIRC, there is some way to hook in and use a custom unittest-runner. How does one go about that? http://dlang.org/phobos/core_runtime.html#.Runtime.moduleUnitTester -- /Jacob Carlborg

Usage of DDOC_KEYWORD and DDOC_TEMPLATE_PARAM macros

2016-09-27 Thread Jacob Carlborg via Digitalmars-d-learn
I'm working on a Ddoc theme and I have trouble figuring out when the DDOC_KEYWORD and DDOC_TEMPLATE_PARAM macros are used. Are the compiler outputting them or should the developer be using those directly? If the compiler is outputting them, then when is it doing that? -- /Jacob Carlborg

Re: Reinstalled Mac

2016-09-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-28 10:18, Joel wrote: I've got my Mac reinstalled. I haven't installed D (dmd) yet. I would like to hear what people think. I'm thinking using home brew. And install the latest Code X. You need Xcode and I recommend installing using DVM [1]. It allows you to have multiple versions

Re: Reinstalled Mac

2016-09-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 03:43, David Nadlinger wrote: Jacob is also the author of DVM, so he might be a bit biased. ;) And you would never recommend LDC? ;) I've had good experiences using Homebrew, although you sometimes have to wait a day or three for a new release to appear. — David DVM doesn't h

Re: Reinstalled Mac

2016-09-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 03:33, Joel wrote: Oops, I got confused and installed with homebrew. I was going to try DVM. You can install using DVM as well, it will take precedence. -- /Jacob Carlborg

Re: Reinstalled Mac

2016-09-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 10:29, Paolo Invernizzi wrote: It seems simple: --- hw0062:~ pinver$ brew info dmd dmd: stable 2.071.2 (bottled), HEAD D programming language compiler for OS X https://dlang.org/ /usr/local/Cellar/dmd/2.071.0_1 (561 files, 65.0M) Poured from bottle on 2016-06-23 at 14:51:10 /usr

Re: Learning ddoc

2016-09-29 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 11:35, Antonio Corbi wrote: Hi, I'm in the process of learning how ddoc works. I've successfully created docs for my code and recently learned how to generate it using dub. Related to this and after seeing the announcement of the new release of the emsi-containers library, I had a

Re: Reinstalled Mac

2016-09-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 18:28, Paolo Invernizzi wrote: Ummm... All the installed stuff is pretty well organised inside `/usr/local`, so this works... --- hw0062:~ pinver$ /usr/local/Cellar/dmd/2.071.2/bin/dmd --version DMD64 D Compiler v2.071.2 Copyright (c) 1999-2015 by Digital Mars written by Walter Br

Re: Reinstalled Mac

2016-09-30 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-29 14:59, Guillaume Piolat wrote: More or less related: it would be nice if DVM supports LDC fetching and switching. The use case I see is that you often want one DMD and one LDC. Yeah, that would be nice. Would it be interesting to have "dmd" point to "ldmd2" when LDC is selected

Re: Reinstalled Mac

2016-10-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-30 16:17, Guillaume Piolat wrote: Confusing. For me it's much more common to want a current DMD compiler and a current LDC compiler. My idea was that this would allow to compile using LDC for a build script that was only designed with DMD in mind. Of course the "ldc2" and "ldmd2"

Re: Get date at compile time

2016-10-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-01 17:00, pineapple wrote: Has there been consideration for adding separate integral tokens for day, month, year, etc? I think it would be better to implement a parse function for std.datetime which works at compile time. We need a parse function anyway. -- /Jacob Carlborg

Re: Usage of DDOC_KEYWORD and DDOC_TEMPLATE_PARAM macros

2016-10-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-27 22:21, Jacob Carlborg wrote: I'm working on a Ddoc theme and I have trouble figuring out when the DDOC_KEYWORD and DDOC_TEMPLATE_PARAM macros are used. Are the compiler outputting them or should the developer be using those directly? If the compiler is outputting them, then when is

Re: vibe.d Logger

2016-10-03 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-03 12:36, Chris wrote: Is this the preferred logging module for vibe.d: http://vibed.org/api/vibe.core.log/ There is also: http://vibed.org/api/vibe.http.log/ which is there for backwards compatibility? The second one is specific for HTTP. The first one is generic. -- /Jacob Car

Re: What exactly does the compiler switch -betterC do?

2016-10-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-05 11:39, Martin Nowak wrote: Because you're linking with druntime/phobos which drags in plenty of symbols (including a GC). Also Jakob is showing the symbols of the object file, not executable. No. There's a difference between DMD 2.070.0 and 2.071.0: $ cat main.d module main; ex

Re: How to do "inheritance" in D structs

2016-10-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-12 04:33, lobo wrote: This approach works nicely although it feels clumsy but that's probably just because I'm so used to C++. It also handles private members as I'd expect, i.e. they're not accessible outside module scope through the alias struct instance, but there is no protected.

Re: How to do "inheritance" in D structs

2016-10-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-12 03:22, lobo wrote: Hi, I'm coming from C++ and wondered if the pattern below has an equivalent in D using structs. I could just use classes and leave it up to the caller to use scoped! as well but I'm not sure how that will play out when others start using my lib. Thanks, lobo m

Re: Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10

2016-10-17 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-17 10:55, Nordlöw wrote: It's the target `idgen` that fails for me. "idgen" is a separate target [1]. It's a tool that generates some code. [1] https://github.com/dlang/dmd/blob/master/src/posix.mak#L389 -- /Jacob Carlborg

Re: Any recent success with SWIG?

2016-10-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-10-19 18:38, Ryan wrote: I would like to use a library with a c interface from D (gdal actually), but I can't find any bindings. I've looked at htod, but I also see that gdal has project maintained SWIG interfaces and SWIG claims to work with D (both D1 and D2). So I installed the latest

Combining "chunkBy" and "until" algorithms

2016-11-04 Thread Jacob Carlborg via Digitalmars-d-learn
I have a file with a bunch of lines I want to process. I want to process these lines line by line. Most of these lines have the same pattern. Some of the lines have a different pattern. I want to bundle those lines, which have a non-standard pattern, together with the last line that had the sta

Re: Combining "chunkBy" and "until" algorithms

2016-11-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-04 16:23, Edwin van Leeuwen wrote: Could you filter [1] for the non standard pattern? Filter is lazy, so will only start looking for the next when the current one has been "handled". Hmm, no I don't think so. Do you have an example of how this would work? -- /Jacob Carlborg

Re: Combining "chunkBy" and "until" algorithms

2016-11-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-05 14:57, Timon Gehr wrote: "chunkBy" a predicate that checks whether a line is standard. Use 'zip' to focus two adjacent chunks at the same time. Use 'filter' to only consider adjacent chunks where the first chunk consists of standard lines. Then extract the last line of the first ch

Re: implementing --version?

2016-11-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-21 22:32, mab-on wrote: On Monday, 21 November 2016 at 20:56:41 UTC, Karabuta wrote: There is a package in the dub registry called commando (https://code.dlang.org/packages/commando) for that. Hm.. maybe i explained it wrong. My problem is not to pass a argument to the application.

<    1   2   3   4   5   6   7   >