Re: Beta 2.086.0

2019-04-26 Thread bitwise via Digitalmars-d-announce
On Saturday, 20 April 2019 at 14:16:09 UTC, Martin Nowak wrote: [...] __traits for private symbols AND copy constructors?!?! Awesome!

Workaround for dub build-path problem

2019-03-11 Thread bitwise via Digitalmars-d-learn
https://github.com/dlang/dub/issues/658 As noted in the above issue, dub runs in the root project directory for all packages, including dependancies. So if any project aside from the root project includes a relative path in it's dub.json, that dub build will break, due to the incorrect

Re: Make Dub output *.di files

2019-03-09 Thread bitwise via Digitalmars-d-learn
On Saturday, 9 March 2019 at 19:08:22 UTC, bitwise wrote: On Saturday, 9 March 2019 at 18:39:29 UTC, bitwise wrote: Is it possible to get Dub to output import headers for compiled D files? I found this, which almost works: "dflags": [ "-H", "-Hdimport", "-op" ] The only problem is that Dub

Re: Make Dub output *.di files

2019-03-09 Thread bitwise via Digitalmars-d-learn
On Saturday, 9 March 2019 at 18:39:29 UTC, bitwise wrote: Is it possible to get Dub to output import headers for compiled D files? I found this, which almost works: "dflags": [ "-H", "-Hdimport", "-op" ] The only problem is that Dub runs *above* the source directory, resulting in all my

Make Dub output *.di files

2019-03-09 Thread bitwise via Digitalmars-d-learn
Is it possible to get Dub to output import headers for compiled D files?

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-08 Thread bitwise via Digitalmars-d-announce
On Saturday, 9 February 2019 at 00:04:20 UTC, Dennis wrote: On Friday, 8 February 2019 at 23:58:49 UTC, H. S. Teoh wrote: Yep, the moral of the story is, if codegen quality is important to you, use ldc (and presumably gdc too) rather than dmd. That's definitely true, but that leaves the

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-08 Thread bitwise via Digitalmars-d-announce
On Monday, 4 February 2019 at 20:08:39 UTC, Paul Backus wrote: On Monday, 4 February 2019 at 18:35:37 UTC, bitwise wrote: On Monday, 4 February 2019 at 18:32:56 UTC, Dominikus Dittes Scherkl wrote: I don't understand this. What does "(return)?" mean? Is this valid D syntax? What do I miss?

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-04 Thread bitwise via Digitalmars-d-announce
On Monday, 4 February 2019 at 18:32:56 UTC, Dominikus Dittes Scherkl wrote: I don't understand this. What does "(return)?" mean? Is this valid D syntax? What do I miss? I meant for that to be interpreted like a Regular expression, denoting conditional presence of the return statement. I'm

Re: DIP 1016--ref T accepts r-values--Formal Assessment

2019-02-04 Thread bitwise via Digitalmars-d-announce
On Thursday, 24 January 2019 at 07:18:58 UTC, Mike Parker wrote: Walter and Andrei have declined to accept DIP 1016, "ref T accepts r-values", on the grounds that it has two fundamental flaws that would open holes in the language. fun(10) ==> { T __temp0 = void; fun(__temp0 := 10); }

Re: Are Fibers just broken in D?

2018-04-24 Thread bitwise via Digitalmars-d-learn
On Friday, 20 April 2018 at 18:58:36 UTC, Byron Moxie wrote: [...] In WIN32 it looks like its leaking memory Unless there is something I'm misunderstanding, it seems that Fibers that were not run to completion won't unroll their stack, which would mean that some destructors wouldn't be

Re: How do I set a class member value by its name in a string?

2017-12-27 Thread bitwise via Digitalmars-d-learn
On Wednesday, 27 December 2017 at 20:04:29 UTC, Marc wrote: I'd like to set the members of a class by its name at runtime, I would do something like this: __traits(getMember, myClass, name) = value; but since name is only know at runtime, I can't use __traits(). What's a workaround for

git workflow for D

2017-12-03 Thread bitwise via Digitalmars-d-learn
I've finally started learning git, due to our team expanding beyond one person - awesome, right? Anyways, I've got things more or less figured out, which is nice, because being clueless about git is a big blocker for me trying to do any real work on dmd/phobos/druntime. As far as working on a

Re: Note from a donor

2017-10-25 Thread bitwise via Digitalmars-d
On Tuesday, 24 October 2017 at 22:19:59 UTC, jmh530 wrote: On Tuesday, 24 October 2017 at 21:11:37 UTC, Andre Pany wrote: [...] I'm sympathetic to your point. I think there was/is some effort to allow LLD (the LLVM linker) as a replacement for the MSVC linker in LDC. Perhaps if LLD could

Re: My two cents

2017-10-22 Thread bitwise via Digitalmars-d
On Saturday, 21 October 2017 at 21:31:45 UTC, Walter Bright wrote: On 10/21/2017 1:40 PM, Adam Wilson wrote: Walter has stated numerous times both here and at conferences that Async/Await is definitely a goal. Async/Await can be implemented by rewriting ("lowering") the code to simpler D

Re: My two cents

2017-10-21 Thread bitwise via Digitalmars-d
On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote: async/await (vibe.d is nice but useless in comparison to C# or js async/await idiom) Reference counting when we cannot use GC... If I understand correctly, both of these depend on implementation of 'scope' which is being

Re: Will D continu to live after walter death?

2017-10-15 Thread bitwise via Digitalmars-d
On Friday, 13 October 2017 at 10:07:39 UTC, Walter Bright wrote: On 10/12/2017 8:04 AM, moechofe wrote: What is the wanted lifetime of the project? Is D will manage to pass through time? It is valuable to start a 40 years old project using D? Just download my engrams into the D-9000 computer.

Re: Undo?

2017-10-12 Thread bitwise via Digitalmars-d-learn
On Tuesday, 10 October 2017 at 02:36:56 UTC, Mr. Jonse wrote: I requiring an undo feature in my code. Rather than go the regular route of using commands, I'm wondering if D can facilitate an undo system quite easily? We can think of an undo system in an app as a sort of recorder. The

Re: DlangIDE v0.8.0 released

2017-10-05 Thread bitwise via Digitalmars-d-announce
On Tuesday, 3 October 2017 at 11:35:55 UTC, Vadim Lopatin wrote: On Monday, 2 October 2017 at 16:50:38 UTC, bitwise wrote: On Tuesday, 26 September 2017 at 15:20:54 UTC, Vadim Lopatin wrote: [...] Is C++ integration on the roadmap? My main project has a platform abstraction layer for

Re: Proposal: Object/?? Destruction

2017-10-04 Thread bitwise via Digitalmars-d
On Wednesday, 4 October 2017 at 12:06:43 UTC, John Colvin wrote: [...] People often call this "destructuring" or "unpacking" to avoid confusion with destructors. Or "Structured Bindings" ;) http://en.cppreference.com/w/cpp/language/structured_binding

Re: DlangIDE v0.8.0 released

2017-10-02 Thread bitwise via Digitalmars-d-announce
On Tuesday, 26 September 2017 at 15:20:54 UTC, Vadim Lopatin wrote: [...] Is C++ integration on the roadmap? My main project has a platform abstraction layer for graphics, and libraries for which no bindings are available, so I use Visual D right now, which lets me simply drag all my C++

Re: AliasSeq of T.tupleof for class and all base classes

2017-10-01 Thread bitwise via Digitalmars-d-learn
On Saturday, 30 September 2017 at 12:42:17 UTC, Steven Schveighoffer wrote: [...] https://issues.dlang.org/show_bug.cgi?id=17870

Re: I need runtime reflection

2017-10-01 Thread bitwise via Digitalmars-d
On Sunday, 1 October 2017 at 15:53:57 UTC, Gheorghe Gabriel wrote: On Saturday, 30 September 2017 at 19:06:20 UTC, bitwise wrote: On Friday, 29 September 2017 at 16:40:38 UTC, Gheorghe Gabriel wrote: [...] Still work to do, but usable. https://github.com/nicolasjinchereau/d-reflection I

Re: @property with 2 arguments

2017-10-01 Thread bitwise via Digitalmars-d-learn
On Sunday, 1 October 2017 at 05:57:53 UTC, Tony wrote: "@property functions can only have zero, one or two parameters" I am looking for an example of an @property function defined with two parameters and the syntax for how it is accessed without (). And also this, which probably shouldn't

Re: I need runtime reflection

2017-09-30 Thread bitwise via Digitalmars-d
On Friday, 29 September 2017 at 16:40:38 UTC, Gheorghe Gabriel wrote: [...] Still work to do, but usable. https://github.com/nicolasjinchereau/d-reflection

Re: AliasSeq of T.tupleof for class and all base classes

2017-09-30 Thread bitwise via Digitalmars-d-learn
On Saturday, 30 September 2017 at 12:42:17 UTC, Steven Schveighoffer wrote: I think the problem may be that derived classes' tupleof has some of the same variables as the base class? I agree it should work, but I think if it did work, it may not be what you want. You would see a lot of

Re: Alternatives to pointers?

2017-09-29 Thread bitwise via Digitalmars-d
On Friday, 29 September 2017 at 01:51:36 UTC, Jerry wrote: [...] Maybe this? ref auto at(T : U[], U)(T arr, size_t index) { return arr[index]; } int main(string[] argv) { int* a = new int(1); int[] b = [1]; int[1] c = [1]; a.at(0); // won't compile b.at(0);

AliasSeq of T.tupleof for class and all base classes

2017-09-29 Thread bitwise via Digitalmars-d-learn
As far as I can tell, this code should compile: class B { int a; } class D1 : B { int b; } class D2 : D1 { int c; } template TupleOf(Classes...) { static if(Classes.length > 1) alias TupleOf = AliasSeq!(Classes[0].tupleof, TupleOf!(Classes[1..$])); else static

Re: I need runtime reflection

2017-09-29 Thread bitwise via Digitalmars-d
On Friday, 29 September 2017 at 16:40:38 UTC, Gheorghe Gabriel wrote: On Friday, 29 September 2017 at 16:24:32 UTC, bitwise wrote: On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel wrote: [...] If i compile this script to a .dll DLL support for D is currently very spotty. Before

Re: I need runtime reflection

2017-09-29 Thread bitwise via Digitalmars-d
On Friday, 29 September 2017 at 11:05:00 UTC, Gheorghe Gabriel wrote: [...] If i compile this script to a .dll DLL support for D is currently very spotty. Before investing too much time, I would suggest confirming that DLLs are even properly supported for your target platform at all.

Re: DlangIDE v0.8.0 released

2017-09-29 Thread bitwise via Digitalmars-d-announce
On Thursday, 28 September 2017 at 11:25:35 UTC, Vadim Lopatin wrote: [...] Fixed. Awesome, looks perfect now. Thanks!

Re: std.reflection prototype

2017-09-27 Thread bitwise via Digitalmars-d
On Wednesday, 27 September 2017 at 20:38:51 UTC, Gheorghe Gabriel wrote: On Monday, 30 March 2015 at 01:11:55 UTC, bitwise wrote: [...] Hi, your link is not working any more and I really need your implementation. Gabriel I took the code down because there were design flaws I had to work

Re: DlangIDE v0.8.0 released

2017-09-27 Thread bitwise via Digitalmars-d-announce
On Wednesday, 27 September 2017 at 13:22:20 UTC, Vadim Lopatin wrote: On Tuesday, 26 September 2017 at 22:35:09 UTC, bitwise wrote: On Tuesday, 26 September 2017 at 15:20:54 UTC, Vadim Lopatin wrote: New DlangIDE version is released. I've only had time to take a quick look, but this IDE

Re: DlangIDE v0.8.0 released

2017-09-26 Thread bitwise via Digitalmars-d-announce
On Tuesday, 26 September 2017 at 15:20:54 UTC, Vadim Lopatin wrote: New DlangIDE version is released. I've only had time to take a quick look, but this IDE seems pretty good. I was surprised at how fast it loaded up, and how it downloaded the dependencies for the sample project on it's own.

Re: detect implicitly convertible typeid's?

2017-09-26 Thread bitwise via Digitalmars-d-learn
On Tuesday, 26 September 2017 at 19:31:56 UTC, Steven Schveighoffer wrote: [...] I just recently fixed Variant so it could accept shared data (so you could pass shared data using std.concurrency), and part of that depends on the fact that I know nothing else can point at the data (so no

Re: detect implicitly convertible typeid's?

2017-09-26 Thread bitwise via Digitalmars-d-learn
On Tuesday, 26 September 2017 at 17:27:02 UTC, Steven Schveighoffer wrote: -Steve About Variant - I was considering a pull request for retrieving a pointer to the internal data, but figured that it was left out on purpose due to @safety. OTOH, I was looking through dmd commits, and it

Re: detect implicitly convertible typeid's?

2017-09-26 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 15:12:57 UTC, Steven Schveighoffer wrote: [...] I'm not sure of how much use this is, but I do not know enough to say that it's completely useless :) Certainly, some code somewhere has to be able to understand what the actual type of something is. That code

Re: Is it possible to avoid call to destructor for structs?

2017-09-25 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 08:39:26 UTC, Adrian Matoga wrote: [...] You shouldn't store the pointer to barBuffer inside Foo. The language allows moving the structure around with a simple memcpy, so _bar is likely to point into garbage soon after it's assigned. Good point - but it's a

Re: detect implicitly convertible typeid's?

2017-09-25 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 13:20:03 UTC, Steven Schveighoffer wrote: On 9/23/17 11:52 AM, bitwise wrote: Is it possible to tell if two objects represented by TypeInfo's are convertible to each other? Basically, is there a built in way to do this? int x; long y;

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 01:46:15 UTC, Haridas wrote: [...] It all works well so far. But as soon as I create an instance of Bar inside a Dlang class (say Foo) or as part of a Dlang dynamic array, hell follows. At some point, Dlang's GC kicks in and Bar's destructor gets called from

Re: 100,000th thread on the NG

2017-09-24 Thread bitwise via Digitalmars-d
On Sunday, 24 September 2017 at 04:24:55 UTC, user1234 wrote: This is the 100,000th Thread. https://m.popkey.co/61642c/WxA4D.gif

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread bitwise via Digitalmars-d-learn
On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote: In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed? Don't construct it to begin with. struct Bar { import std.stdio : writeln; int a = 123;

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread bitwise via Digitalmars-d
On Sunday, 24 September 2017 at 08:08:35 UTC, Petar Kirov [ZombineDev] wrote: On Saturday, 23 September 2017 at 22:07:58 UTC, bitwise wrote: [...] Can you give a bit more details? What kind of architectures do you mean (hardware, software, ..)? What was your use case? IO-multiplexing,

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-23 Thread bitwise via Digitalmars-d
On Friday, 22 September 2017 at 09:48:47 UTC, Sönke Ludwig wrote: Am 21.09.2017 um 20:49 schrieb bitwise: Doesn't vibe-d use Fibers? I tried to build a simple web server with a fiber-based approach once - it was horribly slow. I hope C# (and soon C++) style stackless resumable functions

detect implicitly convertible typeid's?

2017-09-23 Thread bitwise via Digitalmars-d-learn
Is it possible to tell if two objects represented by TypeInfo's are convertible to each other? Basically, is there a built in way to do this? int x; long y; assert(typeid(x).isImplicitlyConvertibleTo(typeid(y)); Thanks

Re: Finding class template instantiations via runtime reflection (for openmethods)

2017-09-22 Thread bitwise via Digitalmars-d
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last

Re: Finding class template instantiations via runtime reflection (for openmethods)

2017-09-22 Thread bitwise via Digitalmars-d
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last

Re: Finding class template instantiations via runtime reflection (for openmethods)

2017-09-22 Thread bitwise via Digitalmars-d
On Thursday, 21 September 2017 at 20:32:38 UTC, Jean-Louis Leroy wrote: Neither 'Bar!int' nor 'BarInt' appear in 'localClasses'. Ideas? The information you can retrieve through localClasses is limited. AFAIK it only retrieves plain non-template classes declared directly in the module. Last

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-21 Thread bitwise via Digitalmars-d
On Thursday, 21 September 2017 at 18:55:04 UTC, Vadim Lopatin wrote: On Thursday, 21 September 2017 at 18:49:00 UTC, bitwise wrote: On Thursday, 21 September 2017 at 08:01:23 UTC, Vadim Lopatin wrote: [...] Doesn't vibe-d use Fibers? I tried to build a simple web server with a fiber-based

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-21 Thread bitwise via Digitalmars-d
On Thursday, 21 September 2017 at 08:01:23 UTC, Vadim Lopatin wrote: There is a simple set of simple web server apps written in several languages (Go, Rust, Scala, Node-js): https://github.com/nuald/simple-web-benchmark I've sent PR to include D benchmark (vibe.d). I was hoping it could show

Re: extern(C) enum

2017-09-17 Thread bitwise via Digitalmars-d-learn
On Monday, 18 September 2017 at 00:12:49 UTC, Mike Parker wrote: On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote: [...] I've been maintaining bindings to multiple C libraries (including Freetype 2 bindings) for 13 years now. I have never encountered an issue with an enum size

Re: extern(C) enum

2017-09-17 Thread bitwise via Digitalmars-d-learn
On Sunday, 17 September 2017 at 18:44:47 UTC, nkm1 wrote: On Sunday, 17 September 2017 at 17:06:10 UTC, bitwise wrote: [...] Just put the burden on the users then. It's implementation defined, so they are in position to figure it out... This isn't something that can really be done with

Re: extern(C) enum

2017-09-17 Thread bitwise via Digitalmars-d-learn
On Saturday, 16 September 2017 at 12:34:58 UTC, nkm1 wrote: On Saturday, 16 September 2017 at 03:06:24 UTC, Timothy Foster wrote: [...] [...] So it appears I'm screwed then. Example: typedef enum FT_Size_Request_Type_ { FT_SIZE_REQUEST_TYPE_NOMINAL, FT_SIZE_REQUEST_TYPE_REAL_DIM,

Re: The case for integer overflow checks?

2017-09-15 Thread bitwise via Digitalmars-d
On Friday, 15 September 2017 at 21:21:01 UTC, Walter Bright wrote: On 9/15/2017 1:46 AM, Guillaume Piolat wrote: If overflow checks happen to be more or less cheap like (surprinsingly) array bounds checks are, it could be a nice thing to pay for.

Re: extern(C) enum

2017-09-15 Thread bitwise via Digitalmars-d-learn
On Friday, 15 September 2017 at 19:35:50 UTC, nkm1 wrote: On Friday, 15 September 2017 at 19:21:02 UTC, Timothy Foster wrote: I believe C enum size is implementation defined. A C compiler can pick the underlying type (1, 2, or 4 bytes, signed or unsigned) that fits the values in the enum.

Re: Ranges suck!

2017-09-15 Thread bitwise via Digitalmars-d-learn
On Thursday, 14 September 2017 at 23:53:20 UTC, Your name wrote: [...] I understand your frustration. The fact that "inout" is actually a keyword makes it hard not to think that some very strange fetishes were at play during the creation of this language. As a whole though, the language

Re: extern(C) enum

2017-09-15 Thread bitwise via Digitalmars-d-learn
On Friday, 15 September 2017 at 07:24:34 UTC, Jonathan M Davis wrote: On Friday, September 15, 2017 04:15:57 bitwise via Digitalmars-d-learn wrote: I translated the headers for FreeType2 to D, and in many cases, enums are used as struct members. If I declare an extern(C) enum in D

Re: extern(C) enum

2017-09-15 Thread bitwise via Digitalmars-d-learn
On Friday, 15 September 2017 at 06:57:31 UTC, rikki cattermole wrote: On 15/09/2017 5:15 AM, bitwise wrote: I translated the headers for FreeType2 to D, and in many cases, enums are used as struct members. If I declare an extern(C) enum in D, is it guaranteed to have the same underlying type

extern(C) enum

2017-09-14 Thread bitwise via Digitalmars-d-learn
I translated the headers for FreeType2 to D, and in many cases, enums are used as struct members. If I declare an extern(C) enum in D, is it guaranteed to have the same underlying type and size as it would for a C compiler on the same platform?

Re: __traits(compileError, {})

2017-09-11 Thread bitwise via Digitalmars-d
On Monday, 11 September 2017 at 11:07:46 UTC, Timon Gehr wrote: The dangerous thing about this suggestion is that it makes the compilation errors DMD implements de facto part of the semantics of the D language. I.e. improving compiler diagnostics becomes a breaking language change. I guess

Re: __traits(compileError, {})

2017-09-10 Thread bitwise via Digitalmars-d
On Monday, 11 September 2017 at 00:15:08 UTC, Jonathan M Davis wrote: On Sunday, September 10, 2017 23:25:59 bitwise via Digitalmars-d wrote: On Friday, 8 September 2017 at 01:18:46 UTC, bitwise wrote: > [...] Does anyone even follow procedures of any kind for additions this trivial, or

Re: __traits(compileError, {})

2017-09-10 Thread bitwise via Digitalmars-d
On Friday, 8 September 2017 at 01:18:46 UTC, bitwise wrote: Lately, I've been hit by several compilation errors when phobos fails to construct an instance of a class or struct I've pass it. Regardless of what the exact failure is, phobos usually gives you some generic error that isn't helpful.

Re: zig

2017-09-08 Thread bitwise via Digitalmars-d
On Friday, 8 September 2017 at 12:37:52 UTC, kinke wrote: On Friday, 8 September 2017 at 08:07:25 UTC, Daniel N wrote: I was just reading the LLVM release notes. Looks quite interesting, did anyone try it? http://ziglang.org/ I noticed it too in the release notes, browsed to the page,

__traits(compileError, {})

2017-09-07 Thread bitwise via Digitalmars-d
Lately, I've been hit by several compilation errors when phobos fails to construct an instance of a class or struct I've pass it. Regardless of what the exact failure is, phobos usually gives you some generic error that isn't helpful. Example: class Test { @disable this(); } int

Re: Is compiling for Android/iOS possible?

2017-09-07 Thread bitwise via Digitalmars-d-learn
On Wednesday, 6 September 2017 at 18:34:28 UTC, Timothy Foster wrote: I'm just wondering if I made an application for Windows/Mac/Linux if I could get it to also work on mobile devices, or would I have to rewrite the application in another language to get it to work? If it's possible, what

Re: D on Tiobe Index

2017-09-06 Thread bitwise via Digitalmars-d-announce
On Wednesday, 6 September 2017 at 11:14:00 UTC, Maksim Fomin wrote: On Thursday, 31 August 2017 at 16:37:35 UTC, SrMordred wrote: On Thursday, 31 August 2017 at 14:57:28 UTC, bitwise wrote: https://www.tiobe.com/tiobe-index/d/ What happened in 2009? My guess is constant random methodology

Re: Function pointer from mangled name at runtime?

2017-09-04 Thread bitwise via Digitalmars-d
On Monday, 4 September 2017 at 06:54:53 UTC, Jacob Carlborg wrote: On 2017-09-01 22:53, bitwise wrote: I'm not sure how your serialization library works Exhaustively. Entire modules or classes can be reflected recursively. or is intended to work. *does ;) But at some point you need a

Re: string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner wrote: [...] Code will eventually look something like the following. The point is to be able to retrieve the exported function at runtime only by knowing what the template arg would have been. export extern(C) const(Reflection)

Re: string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner wrote: In UTF8: --- utfmangle.d --- void fun_ༀ() {} pragma(msg, fun_ༀ.mangleof); --- --- $ dmd -c utfmangle.d _D6mangle7fun_ༀFZv --- Only universal character names for identifiers are allowed, though, as per [1]

Re: string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
On Saturday, 2 September 2017 at 17:45:30 UTC, Moritz Maxeiner wrote: If this (unnecessary waste) is of concern to you (and from the fact that you used ret.reserve I assume it is), then the easy fix is to use `sformat` instead of `format`: Yes, thanks. I'm going to go with a variation of

Re: string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
On Saturday, 2 September 2017 at 17:41:34 UTC, Ali Çehreli wrote: You're right but I think there is no intention of interpreting the result as UTF-8. "f62026" is just to be used as "f62026", which can be converted byte-by-byte back to "ö…". That's how understand the requirement anyway. Ali

Re: string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
On Saturday, 2 September 2017 at 15:53:25 UTC, bitwise wrote: [...] This seems to work well enough. string toAsciiHex(string str) { import std.array : appender; auto ret = appender!string(null); ret.reserve(str.length * 2); foreach(c; str) ret.put(format!"%x"(c)); return

string to character code hex string

2017-09-02 Thread bitwise via Digitalmars-d-learn
I need to convert a string of characters to a string of their hex representations. "AAA" -> "414141" This seems like something that would be in the std lib, but I can't find it. Does it exist? Thanks

Re: Function pointer from mangled name at runtime?

2017-09-02 Thread bitwise via Digitalmars-d
On Friday, 1 September 2017 at 20:27:45 UTC, Jonathan Marler wrote: You would also need to know type information, not just the name itself. If you had a name like mine.A.B.Test, then you would need to know what A, B, and Test are, are they modules, classes, structs, enums, etc Actually

Re: Function pointer from mangled name at runtime?

2017-09-01 Thread bitwise via Digitalmars-d
On Friday, 1 September 2017 at 20:27:45 UTC, Jonathan Marler wrote: [...] I think that I may have left out an important piece information. My reflection library allows this: static r = reflect!(my.package.module); This reflects the entire module recursively, including all classes, enums,

Re: Function pointer from mangled name at runtime?

2017-09-01 Thread bitwise via Digitalmars-d
On Friday, 1 September 2017 at 20:27:45 UTC, Jonathan Marler wrote: Symbol table is usually used to mean the compiler symbol table, so I'm assuming you mean the "export table" in your binary that contains all the exported symbols. The executable will have an entry for those manged getRTInfo

Re: Function pointer from mangled name at runtime?

2017-09-01 Thread bitwise via Digitalmars-d
On Friday, 1 September 2017 at 20:22:21 UTC, Adam D. Ruppe wrote: On Friday, 1 September 2017 at 20:17:54 UTC, bitwise wrote: So I'm thinking now..is this as easy as just figuring out how it's mangled and calling dlsym()? Yeah, that's what I was thinking. You can use the .mangleof property

Re: Function pointer from mangled name at runtime?

2017-09-01 Thread bitwise via Digitalmars-d
On Friday, 1 September 2017 at 19:49:46 UTC, bitwise wrote: [...] oddly, this seems to compile: extern(C) T foo(T)() { return T.init; } So I'm thinking now..is this as easy as just figuring out how it's mangled and calling dlsym()?

Function pointer from mangled name at runtime?

2017-09-01 Thread bitwise via Digitalmars-d
If I have the mangled name of a module-scoped D template function as a string, is there a way to check for it's presence in the symbol table, and retrieve the function pointer at runtime? Example: ` module mine; class Test { } ` ` module reflection; class RuntimeInfo { string name(); }

Re: traits for function having actual source declaration?

2017-09-01 Thread bitwise via Digitalmars-d-learn
On Friday, 1 September 2017 at 17:26:11 UTC, ketmar wrote: [...] they *should* listen. anyone who doesn't just aksing for troubles, and i see no reason to guard 'em further. Yeah...eventually came to the same conclusion ;) Thanks

Re: traits for function having actual source declaration?

2017-09-01 Thread bitwise via Digitalmars-d-learn
On Friday, 1 September 2017 at 14:38:38 UTC, bitwise wrote: When I'm using __traits(allMembers), I get a all the invisible functions added by the compiler as well "__ctor", "__xdtor", "__cpctor", etc.. Is there a way to filter them out? dlang's "Lexical" page says: "Identifiers starting

traits for function having actual source declaration?

2017-09-01 Thread bitwise via Digitalmars-d-learn
When I'm using __traits(allMembers), I get a all the invisible functions added by the compiler as well "__ctor", "__xdtor", "__cpctor", etc.. Is there a way to filter them out?

Re: Events in D

2017-08-31 Thread bitwise via Digitalmars-d
On Thursday, 31 August 2017 at 19:36:00 UTC, kinke wrote: On Wednesday, 30 August 2017 at 15:35:57 UTC, bitwise wrote: -What if I want an event to lock a shared mutex of the enclosing object, without storing a pointer to that mutex inside the event itself (and every single other event in the

Re: D on Tiobe Index

2017-08-31 Thread bitwise via Digitalmars-d-announce
On Thursday, 31 August 2017 at 16:37:35 UTC, SrMordred wrote: On Thursday, 31 August 2017 at 14:57:28 UTC, bitwise wrote: https://www.tiobe.com/tiobe-index/d/ What happened in 2009? My first thought was that it was related to the D1 -> D2 transition, but that wasn't it. Considering that I

Re: Events in D

2017-08-31 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 05:10:25 UTC, bitwise wrote: I needed some C# style events, so I rolled my own. The following is my current event implementation. I was able to make it thread safe by including an optional spin-lock. Of course, that extra spinlock has to be included in every

D on Tiobe Index

2017-08-31 Thread bitwise via Digitalmars-d-announce
https://www.tiobe.com/tiobe-index/d/ Usually, only graphs for the top 20 languages are generated on the Tiobe Index, but they were able to generate this for me (not sure if it expires at some point). In any case, I was happy to see that D has been on the rise for the last few years. I'm

Re: Events in D

2017-08-30 Thread bitwise via Digitalmars-d
On Wednesday, 30 August 2017 at 14:46:12 UTC, Kagamin wrote: https://dpaste.dzfl.pl/f7c5fc49d80f Like this. If you need locking, write another mixin, it's just a very small convenience wrapper. I don't understand how this helps. -What if I want an event to lock a shared mutex of the

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 20:27:11 UTC, kinke wrote: I like the C# event syntax too and came up with the following D analogon, just to prove that a primitive library-based solution in D is doable in 35 lines and can offer as much comfort as C# here. My current implementation looks

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 16:25:33 UTC, Jonathan Marler wrote: [...] While responding to your question, I provided an example for needing access to the host's data members (Mutex), but failed to provide an example of needing an extra delegate-to-host for an event. I just hit that case

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 05:10:25 UTC, bitwise wrote: [...] I think I should clarify for anyone with limited C# experience, that I'm talking about the custom-event syntax, not the regular one-liner syntax: class MyClass { Object myLock; EventHandler _completed; public

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 16:25:33 UTC, Jonathan Marler wrote: On Tuesday, 29 August 2017 at 05:10:25 UTC, bitwise wrote: [...] I'm confused, C# has the same problem with events. They are delegates which under the hood have 2 pointers, a pointer to the method and a pointer to an

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 13:23:50 UTC, Steven Schveighoffer wrote: In Phobos, find gives you a range where the first element is the one you searched for, and the last element is the end of the original range. But what if you wanted all the data *up to* the element instead? What if you

Re: C++ / Why Iterators Got It All Wrong

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 12:50:08 UTC, Robert M. Münch wrote: Maybe of interest: https://www.think-cell.com/en/career/talks/iterators/#1 I haven't read everything, so not sure if it worth to take a look. "superseded" is the wrong word, as ranges cannot do everything iterators can.

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 11:26:36 UTC, Vadim Lopatin wrote: DlangUI includes signal/slot event implementation. https://github.com/buggins/dlangui/blob/master/src/dlangui/core/signals.d Again, this is a library implementation which suffers from the problems described in the original

Re: Events in D

2017-08-29 Thread bitwise via Digitalmars-d
On Tuesday, 29 August 2017 at 08:05:48 UTC, Andrea Fontana wrote: On Tuesday, 29 August 2017 at 05:10:25 UTC, bitwise wrote: [...] static if(op == "+") [...] Maybe "~"? Usually "+" means "sum" not "add"/"concat". Anyway I remember that something similar was used on DFL [1] [1]

Events in D

2017-08-28 Thread bitwise via Digitalmars-d
I needed some C# style events, so I rolled my own. Long story short, the result was unsatisfactory. Library based events are inadequate for basically the same reasons as library based properties (often suggested/attempted in C++). The problem is that the properties/events don't have access

Re: LDC 1.4.0-beta1

2017-08-27 Thread bitwise via Digitalmars-d-announce
On Sunday, 27 August 2017 at 18:30:36 UTC, Joakim wrote: Yes. [...] This is awesome. I appreciate all the hard work. As far as testing, it will be a while before my current project is ready for an android port.

Re: LDC 1.4.0-beta1

2017-08-27 Thread bitwise via Digitalmars-d-announce
On Saturday, 26 August 2017 at 22:35:11 UTC, kinke wrote: * Shipping with ldc-build-runtime, a small D tool to easily (cross-)compile the runtime libraries yourself. * Full Android support, incl. emulated TLS. Does this mean I can actually build D static libraries, link them into an NDK

Re: @safe(bool)

2017-08-25 Thread bitwise via Digitalmars-d
On Saturday, 26 August 2017 at 01:13:56 UTC, 12345swordy wrote: On Friday, 25 August 2017 at 18:18:14 UTC, bitwise wrote: On Thursday, 24 August 2017 at 14:59:05 UTC, 12345swordy wrote: [...] How about actually answering the question instead of assuming that I can't look up the definition of

Re: @safe(bool)

2017-08-25 Thread bitwise via Digitalmars-d
On Thursday, 24 August 2017 at 14:59:05 UTC, 12345swordy wrote: [...] How about actually answering the question instead of assuming that I can't look up the definition of any words? While your statement may sound nice to you, and to some others in this thread, that does not make it

Re: @safe(bool)

2017-08-23 Thread bitwise via Digitalmars-d
On Wednesday, 23 August 2017 at 13:28:37 UTC, 12345swordy wrote: On Wednesday, 23 August 2017 at 02:24:51 UTC, bitwise wrote: [...] Platitudes cause poor language design, not the completely reasonable expectation of good tools. And who is "Platitude" here specifically?

  1   2   3   4   5   6   7   >