Re: Output range of ranges to single buffer

2016-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
edWrite could format an array/range directly like that. The more complex example works by defining "toString" which takes an output range (delegate). But what if I need to format a third party type that I cannot add methods to? UFCS does not seem to work. -- /Jacob Carlborg

Output range of ranges to single buffer

2016-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
} } void main() { auto a = [ Foo(1, "foo", 2), Foo(3, "bar", 4) ]; auto b = '[' ~ a.map!(e => e.to!string).join(", ") ~ ']'; assert(b == "[Foo(1, foo, 2), Foo(3, bar, 4)]"); } -- /Jacob Carlborg

Re: mixed-in ctor not on par with explicit one?

2016-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-01-13 10:48, Shriramana Sharma wrote: This is not what alias <> this is supposed to do, right? No. So how am I supposed to get the mixed in ctors work? Looks like a limitation in the language. -- /Jacob Carlborg

Re: mixed-in ctor not on par with explicit one?

2016-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
declarations can be used to overload together functions declared in different mixins" -- /Jacob Carlborg

Re: Declaring extern(C) declarations with template mixins

2016-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-01-12 22:27, Mathias Lang wrote: https://issues.dlang.org/show_bug.cgi?id=12575 Thanks. -- /Jacob Carlborg

Declaring extern(C) declarations with template mixins

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
n76printfUxPaYi", referenced from: __Dmain in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) -- /Jacob Carlborg

is expression with template parameter list

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
n the condition, i.e. "std.typecons.Nullable!(U)", then I get this compile error: main.d(8): Error: undefined identifier 'U' Shouldn't this work? I have tried with the latest beta an a bunch of older versions of DMD. -- /Jacob Carlborg

Re: Setting up dmd properly

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
om it will print the command it uses for linking. -- /Jacob Carlborg

Re: Type properties

2016-01-07 Thread Jacob Carlborg via Digitalmars-d-learn
NSObject { this(Foo) @selector("initWithFoo:"); } Although, it's still a breaking change, which affect other projects. -- /Jacob Carlborg

Re: link to C++ function in a namespace whose name is a D keyword

2016-01-06 Thread Jacob Carlborg via Digitalmars-d-learn
++, ns) { int foo(int x); } 2. Print the mangling of the function pragma(msg, foo.mangleof); // __ZN2ns3fooEi on OS X 3. Replace "foo" with the name you actually want, "try" in this case __ZN2ns3fooEi -> __ZN2ns3tryEi 4. Use pragma(mangle) to set the mangled name prag

Re: Size of Compiled Program

2016-01-05 Thread Jacob Carlborg via Digitalmars-d-learn
ecture an executable is built for. -- /Jacob Carlborg

Re: @property not available for classes?

2016-01-03 Thread Jacob Carlborg via Digitalmars-d-learn
uctor that initializes all members to what they are set to in the class declaration. But you cannot pass in any arguments to the default constructor. Hmm, technically that might actually not be the constructor that initializes the members, not sure. -- /Jacob Carlborg

Re: Deimos recommendation still official?

2015-12-21 Thread Jacob Carlborg via Digitalmars-d-learn
have been active in this year 2015. Or is it just because the other C libraries haven't changed (!)... I recommend looking in code.dlang.org as well. -- /Jacob Carlborg

Re: Scope of D packages

2015-12-19 Thread Jacob Carlborg via Digitalmars-d-learn
ame the root package the same as the library/project name. The distribution is done using Dub (see my other post). -- /Jacob Carlborg

Re: Scope of D packages

2015-12-19 Thread Jacob Carlborg via Digitalmars-d-learn
well. [1] http://code.dlang.org/ -- /Jacob Carlborg

Re: exit(1)?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
time register a function with "atexit" that cleans up everything? -- /Jacob Carlborg

Re: No documentation for core.sys?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
symbols to make them show up in the docs [1]. I think the same should be done for core.sys as well. Then at least you know it exists and then can look up the documentation for the C header file for more information. [1] I think it was Steven Schveighoffer that did that enormous work. -- /Jacob

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
l :). The trick is to use metaprogramming and reflection to declare and call the methods. -- /Jacob Carlborg

Re: Segfault while compiling simple program

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-16 11:51, John Colvin wrote: I'd say list it as 'all', chances are it crashes the same on linux as well. If it's an ICE, it's very likely it applies to all platforms. Unless you get an assert/crash in a platform specific file in DMD. -- /Jacob Carlborg

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
nstalled is crucial. Another advantage is that DVM is cross-platform. If you're using multiple platforms you can use the same way to install DMD on all the platforms. -- /Jacob Carlborg

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
alled dmd using X and it didn't work". Shouldn't an installer make sure the files it installed is the files being used? The important thing is not to mix and match installers unless you know how they work. DVM will take precedence :) -- /Jacob Carlborg

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-15 09:08, Mike McKee wrote: On Tuesday, 15 December 2015 at 07:52:50 UTC, Jacob Carlborg wrote: Could you please add "-v" do the command line when compiling. Mine was completely different: $ dmd -v test.d binarydmd version v2.069 config/usr/local/bin/dmd.

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
ll since it uses the C++ interface to call D, not the Objective-C interface. Which there is no reason to do, it could just use the C interface. No point in mixing C++ in the picture. -- /Jacob Carlborg

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
/phobos/std/stdio.d) You can also see the config file used in the beginning of the output above. That tells the compiler where do find the druntime. Please try all these commands directly on the command line without using Xcode in anyway. [1] https://github.com/jacob-carlborg/dvm -- /Jacob Carlborg

Re: I Did It! Calling D Library from Objective C in XCode on OSX

2015-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
sed from D [1]. [1] http://dlang.org/spec/objc_interface.html -- /Jacob Carlborg

Re: Struct initializers as expressions

2015-12-04 Thread Jacob Carlborg via Digitalmars-d-learn
lter would point out as well. It might/will complicate the overloading rules. What if "a" and "b" in T would be integers instead. I think that would be ambiguous. -- /Jacob Carlborg

Re: Which type it better to use for array's indices?

2015-12-04 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-04 14:24, ref2401 wrote: For instance `find(float[] arr, float v)` may return -1 if `v` has not been found. If "find" is returning an index, it could return arr.length to indicate it was not found. -- /Jacob Carlborg

Re: Drawing Native OSX Windows with D

2015-11-29 Thread Jacob Carlborg via Digitalmars-d-learn
, which the users are familiar with. Not how it's done on some other platform. You could also look in to this application [1] that allows you to create PKG packages. [1] http://s.sudre.free.fr/Software/Packages/about.html -- /Jacob Carlborg

Re: Drawing Native OSX Windows with D

2015-11-29 Thread Jacob Carlborg via Digitalmars-d-learn
e size and position of the windows of other applications, not sure about hiding windows though. I'm not entirely sure how they work but they require accessibility to be enabled (System Preferences -> Security & Privacy -> Privacy -> Accessibility). [1] https://manytricks.com/moom/ -- /Jacob Carlborg

Re: Drawing Native OSX Windows with D

2015-11-29 Thread Jacob Carlborg via Digitalmars-d-learn
a/tree/master/examples/window [2] http://dlang.org/spec/objc_interface.html -- /Jacob Carlborg

Re: Drawing Native OSX Windows with D

2015-11-28 Thread Jacob Carlborg via Digitalmars-d-learn
pp Store 2. DMG containing an application bundle 3. Native installer 4. Other ways Building an application that acts like an installer would fall under number 4, that last preferred way. If you can't/don't want to go with the App Store then why not the second option? -- /Jacob Carlborg

Re: dstep problem: "fatal error: 'limits.h' file not found"

2015-11-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-26 10:55, Joseph Rushton Wakeling wrote: OK, I'll do that this evening once I've had an opportunity to check the workaround etc. Thanks! Of course, a pull request is even more welcome. Should be very simple to fix. -- /Jacob Carlborg

Re: dstep problem: "fatal error: 'limits.h' file not found"

2015-11-25 Thread Jacob Carlborg via Digitalmars-d-learn
fines. */ # include_next #endif Hmm, I was pretty sure I fixed this, but perhaps not for that file. Please report an issue. In the meantime there's a workaround in the documentation [1], second paragraph, perhaps not very clear though. [1] https://github.com/jacob-carlborg/dstep#libclang -- /Jacob Carlborg

Re: Any D IDE on Mac OSX with debugging support?

2015-11-16 Thread Jacob Carlborg via Digitalmars-d-learn
with Xcode. But that won't of course have the D support that GDB has. Although I don't know if that works for OS X. -- /Jacob Carlborg

Re: What does the -betterC switch in dmd do?

2015-11-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-16 01:27, Meta wrote: Don't those features require type info? Hmm, now that you mention it. I expected the compiler to give an error as soon as the D runtime was referenced, but that's at least not the case. -- /Jacob Carlborg

Re: What does the -betterC switch in dmd do?

2015-11-15 Thread Jacob Carlborg via Digitalmars-d-learn
another question. I'm pretty sure that the only things that are excluded are module info and type info. It's still possible to use "new" and all the array features that requires support in the runtime (slicing, concatenation, appending and so on). -- /Jacob Carlborg

Re: OSX Foundation framework D binding

2015-11-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-12 09:34, ponce wrote: Opinion. I only ever got problems with bindings that aren't dynamic. For example that problem would not happen with dynamic loading. https://github.com/nomad-software/x11/issues/11 I've never encountered that problem. -- /Jacob Carlborg

Re: OSX Foundation framework D binding

2015-11-12 Thread Jacob Carlborg via Digitalmars-d-learn
s/dstep/browser/dstep [2] https://github.com/DiveFramework/DiveFramework -- /Jacob Carlborg

Re: OSX Foundation framework D binding

2015-11-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-11 10:29, Daniel Kozak via Digitalmars-d-learn wrote: I find only this one: http://code.dlang.org/packages/derelict-cocoa Also, there's no point in complicate the bindings by using function pointers like this. -- /Jacob Carlborg

Re: OSX Foundation framework D binding

2015-11-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-11 17:02, Jacob Carlborg wrote: I would recommend creating new bindings which use the new Objective-C interoperability feature that was added in the latest release (2.069.0). You could use DStep [1] to generate the bindings. It will generate bindings which are not completely

Re: OSX Foundation framework D binding

2015-11-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-11 10:29, Daniel Kozak via Digitalmars-d-learn wrote: I find only this one: http://code.dlang.org/packages/derelict-cocoa I would recommend creating new bindings which use the new Objective-C interoperability feature that was added in the latest release (2.069.0). -- /Jacob

Re: address of overloaded function

2015-10-01 Thread Jacob Carlborg via Digitalmars-d-learn
p;range.front; } --- Not sure why that doesn't work. This works: int foo () { return 0; } void foo (int) {} void main() { int function () a = &foo; void function (int) b = &foo; } -- /Jacob Carlborg

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: OS minimum version

2015-09-21 Thread Jacob Carlborg via Digitalmars-d-learn
3. What is the minimum OS X version required by programs created with LDC? For LDC, OS X 10.7 (Lion). For DMD, 10.6. You would believe such information would be easy to find, but it's not. Took me 10 seconds [1]. [1] http://wiki.dlang.org/LDC#OS_X -- /Jacob Carlborg

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

Identifying and dealing with deprecated/removed language features

2015-09-20 Thread Jacob Carlborg via Digitalmars-d-learn
. What's the best way to deal with this? I guess I can use __traits(compiles) to check if typedef and then insert the "static if" with a string mixing. But is there a better way to do this? -- /Jacob Carlborg

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

Re: Why do abstract class functions require definitions?

2015-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
ract class // (different from now) extern void bar3(); // non-abstract, but defined externally } Currently "extern" has the meaning, at least on Windows, that the symbol will be visible outside a dynamic library. -- /Jacob Carlborg

Re: Why do abstract class functions require definitions?

2015-09-16 Thread Jacob Carlborg via Digitalmars-d-learn
hat the method could be implemented in a different library that are resolved during link time. As already answered in another post, the solution is to prefix the method declaration with "abstract". -- /Jacob Carlborg

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

2015-09-13 Thread Jacob Carlborg via Digitalmars-d-learn
use a pragma to put functions in these sections, but I don't know if DMD has such a pragma. I don't know what the equivalent is for Apple's Mach-O shared libraries. It's supported in Mach-O as well, not sure about the section names though. -- /Jacob Carlborg

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

2015-09-12 Thread Jacob Carlborg via Digitalmars-d-learn
he case! I really need to explore the boundaries of what point you have to actually initialize the D runtime… Well, if your D function doesn't use anything of the runtime I guess it's not necessary. Example: void foo () { printf("foo\n"); } -- /Jacob Carlborg

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

2015-09-11 Thread Jacob Carlborg via Digitalmars-d-learn
. You can initialize the runtime as many times you like, assuming you also deinitialize it the same number of times. -- /Jacob Carlborg

Re: C++ Interop -- Two Questions

2015-09-09 Thread Jacob Carlborg via Digitalmars-d-learn
ion in C or C++ for static member functions? The documentation for the C++ support is very outdated. I recommend to give it a try and see what happens :). Alternatively look in the DMD test suite and see what you can find, or the DMD source code now when it's in D. -- /Jacob Carlborg

Re: Chaining struct method invocations

2015-09-07 Thread Jacob Carlborg via Digitalmars-d-learn
you might want to use a class instead. -- /Jacob Carlborg

Re: Working Windows GUI library?

2015-09-04 Thread Jacob Carlborg via Digitalmars-d-learn
ports Windows and Linux. I have not tried the accessible features but I know it has some code for that. All documentation for SWT should be applicable. [1] https://github.com/d-widget-toolkit/dwt -- /Jacob Carlborg

Re: Class info on interfaces

2015-08-29 Thread Jacob Carlborg via Digitalmars-d-learn
at looks like a pretty good idea, thanks. I'm wondering if it's worth implementing a trait for this in the compiler. -- /Jacob Carlborg

Re: Class info on interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
lizing, at least not with the default deserialization process. -- /Jacob Carlborg

Re: Class info on interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
== 0 - COM interfaces: __traits(getVirtualIndex, CPPInterface.firstFunction) == 0 and inherit IUnknown I'm wondering how reliable that is. Might be better to check the linkage of a method in the interface as Adam suggested. -- /Jacob Carlborg

Re: (De)Serializing interfaces

2015-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
piler errors. I've added support for interfaces to Orange now. -- /Jacob Carlborg

Re: Class info on interfaces

2015-08-27 Thread Jacob Carlborg via Digitalmars-d-learn
, then you can typeid or classinfo it. Is it possible to detect at compile time if an interface is not a native D interface? Now when I think about it, we actually have four (!) different kinds of interfaces. Native D, C++, Objective-C and COM. -- /Jacob Carlborg

Class info on interfaces

2015-08-26 Thread Jacob Carlborg via Digitalmars-d-learn
= new Bar; writeln(f.classinfo); } The above program will print the static type "main.Foo" instead of the dynamic type "main.Bar". -- /Jacob Carlborg

Re: A better way than foreach with this?

2015-08-23 Thread Jacob Carlborg via Digitalmars-d-learn
foreach (ref name; names) name = replace(name, "_", " "); Why not call the "replace" function directly on "names"? -- /Jacob Carlborg

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

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: automatically verifying code samples in phobos docs

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
ay around. char[] is mutable while string is not. Someone else can have a reference to the same data and change it will it's typed as "string", breaking the type system. -- /Jacob Carlborg

Re: Empty struct, any runtime cost?

2015-08-19 Thread Jacob Carlborg via Digitalmars-d-learn
y -gcsections ( or w/e its called ). I think the compiler still generates typeinfo for it. -- /Jacob Carlborg

Re: extern(C) with function returning user type

2015-07-30 Thread Jacob Carlborg via Digitalmars-d-learn
mezlqdknmn...@forum.dlang.org#post-nsjafpymezlqdknmnkhi:40forum.dlang.org -- /Jacob Carlborg

Re: How does __traits and std.traits differ?

2015-07-24 Thread Jacob Carlborg via Digitalmars-d-learn
it has double underscore prefix. * It's not possible to implement everything that __traits does in a library solution, i.e. std.traits -- /Jacob Carlborg

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

2015-07-22 Thread Jacob Carlborg via Digitalmars-d-learn
P. Either you can set the value in the constructor or turn "speed" in to a method/property. I think it's easiest to set it in the constructor: class Airplane : Vehicle { this() { speed = 100; } } -- /Jacob Carlborg

Re: C bindings: typedef struct conflicts with method

2015-07-22 Thread Jacob Carlborg via Digitalmars-d-learn
? -- /Jacob Carlborg

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-20 Thread Jacob Carlborg via Digitalmars-d-learn
int timeout_ms); ``` what the correct way to bind these? Please report an issue for this. In this case "rd_kafka_metadata_t" should be used for the struct name. -- /Jacob Carlborg

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: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
couple of projects 1 hour per week... It's possible to run OS X on non-Apple computers, including virtual machines. But this is not the place to discuss this. -- /Jacob Carlborg

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
ive-C. -- /Jacob Carlborg

Re: Template function that accept strings and array of strings

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
o use/call the function. Could you give an example with all the different types you want to call the function? -- /Jacob Carlborg

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
brary/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/index.html#//apple_ref/c/econst/NSApplicationSupportDirectory [4] http://stackoverflow.com/questions/5123361/finding-library-application-support-from-c -- /Jacob Carlborg

Re: Environment variable for application storage under OSX ?

2015-07-17 Thread Jacob Carlborg via Digitalmars-d-learn
can confirm ? Yes, that's correct. Some applications skip the "Application Support" directory and creates the "SuperDownloader2015" directory directly in $HOME/Library -- /Jacob Carlborg

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

2015-07-16 Thread Jacob Carlborg via Digitalmars-d-learn
you really want something approximating overriding variables, then you can just use property functions to access the variable rather than accessing it directly, and then you can override the property functions. In Scala all public instance variables are implemented as methods, if I recall correctly. -- /Jacob Carlborg

Re: Template function that accept strings and array of strings

2015-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
", "bar"); foo("foo".dup, "bar".dup); auto a = ["foo", "bar"]; foo(a); auto b = ["foo".dup, "bar".dup]; foo(b); } -- /Jacob Carlborg

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

2015-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
ck = (Derived d) { d.derivedFunc(); }; Base[] bases = [d]; foreach (b ; bases) b.foo(); } -- /Jacob Carlborg

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

2015-07-14 Thread Jacob Carlborg via Digitalmars-d-learn
(); d.callback = (Derived d) { /* Do something */ } } Obviously this won't compile, since the callback function needs to have Base as parameter, not Derived. You can cast the delegate. It's probably unsafe but a simple example works. -- /Jacob Carlborg

Re: Binding Nested C Structs

2015-07-10 Thread Jacob Carlborg via Digitalmars-d-learn
; } struct { int nCount; GIntBig* paList; } } But that is obviously not going to work. Does anyone know the right way to handle nested C structs of that form. I think it will work but the API would be different. -- /Jacob Carlborg

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: Exec function D from C++

2015-06-21 Thread Jacob Carlborg via Digitalmars-d-learn
++: extern (C) bool rt_init(); extern (C) bool rt_term(); -- /Jacob Carlborg

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

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
PC in a virtual machine, it's quite cumbersome to do, but it's doable. -- /Jacob Carlborg

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

2015-06-12 Thread Jacob Carlborg via Digitalmars-d-learn
version you can run on that particular machine. -- /Jacob Carlborg

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: Initialising global associative array

2015-06-06 Thread Jacob Carlborg via Digitalmars-d-learn
31962.digitalmars-d-learn:40puremagic.com I understand the concept of this() insofar as returning a reference to an object but what is 'this' in the context referred to? A reference to the module?? "static this" is a module constructor. It's run before the "main" function is run. -- /Jacob Carlborg

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

2015-06-04 Thread Jacob Carlborg via Digitalmars-d-learn
ied but my is expression kung fu was weak. Unfortunately this is not implemented yet. But there's a pull request [1]. [1] https://github.com/D-Programming-Language/dmd/pull/3515 -- /Jacob Carlborg

Re: deserialization: creating a class instance without calling constructor

2015-05-21 Thread Jacob Carlborg via Digitalmars-d-learn
s not safe and something is missing. Here's how I do it in my serialization library Orange [1] [1] https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L166 -- /Jacob Carlborg

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: [dvm] Can't install compilers on Mac

2015-04-30 Thread Jacob Carlborg via Digitalmars-d-learn
(a new tab or window in Terminal) and run "type dvm | head -1". It should print "dvm is a function". Maybe I should just download it and compile it myself? No, should not be necessary and would most likely not make a difference. -- /Jacob Carlborg

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

2015-04-28 Thread Jacob Carlborg via Digitalmars-d-learn
t/d/tango/tango/core/Exception.d(59): /Users/name/.dvm/bin/dmd-2.067.0 :: No such file or directory OS X Version 0.4.3 Have you installed DVM itself, running "./dvm install dvm"? Can you please add the verbose flag, "-v", when installing a compiler and posting the output. -- /Jacob Carlborg

Re: Weird OSX issue

2015-04-24 Thread Jacob Carlborg via Digitalmars-d-learn
ation location, would possibly not be reproducible. I can't reproduce this with DMD from DVM (compiler is installed in the user home directory). -- /Jacob Carlborg

Re: Structural exhaustive matching

2015-04-21 Thread Jacob Carlborg via Digitalmars-d-learn
erhaps not what you're looking for. [1] http://dlang.org/phobos/std_algorithm_comparison.html#.castSwitch -- /Jacob Carlborg

Re: Converting Java code to D

2015-04-20 Thread Jacob Carlborg via Digitalmars-d-learn
grammer, and my time with Java was before enums. But this is how I would do it. This is probably the best translation, depending on if the Java API needs to be retained or not. "label" is not included in this translation, assuming you can access that in Java. -- /Jacob Carlborg

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
date and clean? -- /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
rated/linux/release/64/libphobos2.a(curl.o): In function `_D3std3net4curl4HTTP21_sharedStaticCtor1542FZv': std/net/curl.d:(.text._D3std3net4curl4HTTP21_sharedStaticCtor1542FZv+0xf): undefined reference to `curl_version_info' Do you have libcurl installed? -- /Jacob Carlborg

<    1   2   3   4   5   6   7   8   9   10   >