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
}
}
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
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
declarations can be used to overload together functions declared in
different mixins"
--
/Jacob Carlborg
On 2016-01-12 22:27, Mathias Lang wrote:
https://issues.dlang.org/show_bug.cgi?id=12575
Thanks.
--
/Jacob Carlborg
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
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
om it will print the command it uses for linking.
--
/Jacob Carlborg
NSObject
{
this(Foo) @selector("initWithFoo:");
}
Although, it's still a breaking change, which affect other projects.
--
/Jacob Carlborg
++, 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
ecture an executable
is built for.
--
/Jacob Carlborg
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
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
ame the root package the same as the library/project name.
The distribution is done using Dub (see my other post).
--
/Jacob Carlborg
well.
[1] http://code.dlang.org/
--
/Jacob Carlborg
time register a function with
"atexit" that cleans up everything?
--
/Jacob Carlborg
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
l :). The trick is to use metaprogramming and
reflection to declare and call the methods.
--
/Jacob Carlborg
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
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
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
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.
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
/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
sed from D [1].
[1] http://dlang.org/spec/objc_interface.html
--
/Jacob Carlborg
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
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
, 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
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
a/tree/master/examples/window
[2] http://dlang.org/spec/objc_interface.html
--
/Jacob Carlborg
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
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
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
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
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
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
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
s/dstep/browser/dstep
[2] https://github.com/DiveFramework/DiveFramework
--
/Jacob Carlborg
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
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
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
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
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
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
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
. 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
On 2015-09-18 17:45, Jakob Ovrum wrote:
That's `export`.
Right, my bad. D has too many attributes :)
--
/Jacob Carlborg
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
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
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
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
. You can initialize the runtime as many times you like,
assuming you also deinitialize it the same number of times.
--
/Jacob Carlborg
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
you
might want to use a class instead.
--
/Jacob Carlborg
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
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
lizing, at least not with the default deserialization process.
--
/Jacob Carlborg
== 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
piler errors.
I've added support for interfaces to Orange now.
--
/Jacob Carlborg
, 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
= new Bar;
writeln(f.classinfo);
}
The above program will print the static type "main.Foo" instead of the
dynamic type "main.Bar".
--
/Jacob Carlborg
foreach (ref name; names)
name = replace(name, "_", " ");
Why not call the "replace" function directly on "names"?
--
/Jacob Carlborg
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
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
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
y -gcsections ( or w/e its called ).
I think the compiler still generates typeinfo for it.
--
/Jacob Carlborg
mezlqdknmn...@forum.dlang.org#post-nsjafpymezlqdknmnkhi:40forum.dlang.org
--
/Jacob Carlborg
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
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
?
--
/Jacob Carlborg
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
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
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
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
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
ive-C.
--
/Jacob Carlborg
o use/call the function.
Could you give an example with all the different types you want to call
the function?
--
/Jacob Carlborg
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
can confirm ?
Yes, that's correct. Some applications skip the "Application Support"
directory and creates the "SuperDownloader2015" directory directly in
$HOME/Library
--
/Jacob Carlborg
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
", "bar");
foo("foo".dup, "bar".dup);
auto a = ["foo", "bar"];
foo(a);
auto b = ["foo".dup, "bar".dup];
foo(b);
}
--
/Jacob Carlborg
ck = (Derived d) { d.derivedFunc(); };
Base[] bases = [d];
foreach (b ; bases)
b.foo();
}
--
/Jacob Carlborg
();
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
;
}
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
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
++:
extern (C) bool rt_init();
extern (C) bool rt_term();
--
/Jacob Carlborg
PC in a virtual machine, it's quite cumbersome to
do, but it's doable.
--
/Jacob Carlborg
version you can run on that particular machine.
--
/Jacob Carlborg
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
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
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
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
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
(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
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
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
erhaps not what you're looking
for.
[1] http://dlang.org/phobos/std_algorithm_comparison.html#.castSwitch
--
/Jacob Carlborg
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
date and clean?
--
/Jacob Carlborg
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
501 - 600 of 1682 matches
Mail list logo