Re: Getting the parameters and other attributes belonging to the function overload with the greatest number of arguments

2016-05-31 Thread pineapple via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 20:46:37 UTC, Basile B. wrote: Yes this can be done, you must use the getOverload trait: https://dlang.org/spec/traits.html#getOverloads The result of this trait is the function itself so it's not hard to use, e.g the result can be passed directly to 'Parameters', '

Re: Is there any overhead iterating over a pointer using a slice?

2016-05-31 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 18:55:18 UTC, Gary Willoughby wrote: If I have a pointer and iterate over it using a slice, like this: T* foo = &data; foreach (element; foo[0 .. length]) { ... } Is there any overhead compared with pointer arithmeti

Re: Getting the parameters and other attributes belonging to the function overload with the greatest number of arguments

2016-05-31 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 20:06:47 UTC, pineapple wrote: I'd like to find the overload of some function with the most parameters and (in this specific case) to get their identifiers using e.g. ParameterIdentifierTuple. There have also been cases where I'd have liked to iterate over the result

Re: asm woes...

2016-05-31 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 18:52:16 UTC, Marco Leise wrote: The 'this' pointer is usually in some register already. On Linux 32-bit for example it is in EAX, on Linux 64-bit is in RDI. The AX register seems like a bad choice, since you require the AX/DX registers when you do multiplication a

Getting the parameters and other attributes belonging to the function overload with the greatest number of arguments

2016-05-31 Thread pineapple via Digitalmars-d-learn
I'd like to find the overload of some function with the most parameters and (in this specific case) to get their identifiers using e.g. ParameterIdentifierTuple. There have also been cases where I'd have liked to iterate over the result of Parameters!func for each overload of that function. Can

Is there any overhead iterating over a pointer using a slice?

2016-05-31 Thread Gary Willoughby via Digitalmars-d-learn
In relation to this thread: http://forum.dlang.org/thread/ddckhvcxlyuvuiyaz...@forum.dlang.org Where I asked about slicing a pointer, I have another question: If I have a pointer and iterate over it using a slice, like this: T* foo = &data; foreach (element; foo[0 .. length])

Re: Is there any overhead iterating over a pointer using a slice?

2016-05-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 18:55:18 UTC, Gary Willoughby wrote: Is there any overhead compared with pointer arithmetic in a for loop? Very very little. The slice will ensure start and stop indexes are in bounds before the loop (and throw an RangeError if it isn't), but inside the loop, it sho

Re: asm woes...

2016-05-31 Thread Marco Leise via Digitalmars-d-learn
Am Fri, 27 May 2016 10:16:48 + schrieb Era Scarecrow : > On Friday, 27 May 2016 at 10:14:31 UTC, Era Scarecrow wrote: > > inc dword ptr [EAX+Foo.x.offsetof]; > > > So just tested it, and it didn't hang, meaning all unittests > also passed. > > Final solution is: > >asm pure @n

Re: asm woes...

2016-05-31 Thread Marco Leise via Digitalmars-d-learn
Am Fri, 27 May 2016 10:06:28 + schrieb Guillaume Piolat : > Referencing EBP or ESP yourself is indeed dangerous. Not sure why > the documentation would advise that. Using "this", names of > parameters/locals/field offset is much safer. DMD makes sure that the EBP relative access of paramete

Re: Why simple code using Rebindable doesn't compile ?

2016-05-31 Thread chmike via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 06:40:31 UTC, Era Scarecrow wrote: On Tuesday, 31 May 2016 at 05:31:59 UTC, chmike wrote: My conclusion is that rebindable is not a satisfying solution to have mutable references to immutable objects. I don't understand the rationale of these immutable references. I

Re: D, GTK, Qt, wx,…

2016-05-31 Thread albatroz via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 08:57:51 UTC, MGW wrote: QtE5 - is my wrapper for Qt-5 https://www.youtube.com/watch?v=DuOl-4g117E https://github.com/MGWL/QtE5 How can we build QtE5 and/or the examples?

Re: Operator overloading through UFCS doesn't work

2016-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 31, 2016 14:11:58 ixid via Digitalmars-d-learn wrote: > On Sunday, 29 May 2016 at 07:18:10 UTC, Jonathan M Davis wrote: > > And the fact that allowing free functions to overload operators > > via UFCS sends us into that territory just highlights the fact > > that they're a horrible

Re: Why aren't overloaded nested functions allowed?

2016-05-31 Thread Max Samukha via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 11:54:40 UTC, Timon Gehr wrote: On 30.05.2016 18:22, Max Samukha wrote: From the spec (https://dlang.org/spec/function.html#nested): "Nested functions cannot be overloaded." Anybody knows what's the rationale? The rationale is that nobody has implemented it in DMD

Re: Operator overloading through UFCS doesn't work

2016-05-31 Thread ixid via Digitalmars-d-learn
On Sunday, 29 May 2016 at 07:18:10 UTC, Jonathan M Davis wrote: And the fact that allowing free functions to overload operators via UFCS sends us into that territory just highlights the fact that they're a horrible idea. - Jonathan M Davis Do you have any examples of UFCS doing bad things? M

Re: Why aren't overloaded nested functions allowed?

2016-05-31 Thread Timon Gehr via Digitalmars-d-learn
On 30.05.2016 18:22, Max Samukha wrote: From the spec (https://dlang.org/spec/function.html#nested): "Nested functions cannot be overloaded." Anybody knows what's the rationale? The rationale is that nobody has implemented it in DMD. https://issues.dlang.org/show_bug.cgi?id=12578

Re: Why do some T.init evaluate to true while others to false?

2016-05-31 Thread Marc Schütz via Digitalmars-d-learn
On Monday, 30 May 2016 at 19:06:53 UTC, ArturG wrote: does this count? struct Foo { int x; float f; } void main() { Foo foo; if(foo is typeof(foo).init) "A: does'nt work".writeln; foo = Foo(); if(foo is typeof(foo).init) "B: works".writeln; } This one is a bug in DMD.

Re: D, GTK, Qt, wx,…

2016-05-31 Thread MGW via Digitalmars-d-learn
On Sunday, 29 May 2016 at 11:03:36 UTC, Russel Winder wrote: GKT+ has a reputation for being dreadful on OSX and even worse on Windows. Qt on the other hand has a reputation for being the most portable – though clearly wx is (arguable) the most portable. QtE5 - is my wrapper for Qt-5 https:/

Re: @trusting generic functions

2016-05-31 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 29 May 2016 at 18:02:53 UTC, Steven Schveighoffer wrote: You can create a trusted expression by using a lambda and immediately calling it. ag0aep6g brought it up. I would write it like this (untested, but I think this works): return (()@trusted => &t)().doSomething(); The key is to