Re: foo => "bar" key/value literals in D!

2016-06-11 Thread ArturG via Digitalmars-d-announce
On Saturday, 11 June 2016 at 09:07:43 UTC, Andrei Alexandrescu 
wrote:


No, both are nice to have. If one name is needed for both, 
"args" is indeed a good commonality. "Invoke function f with 
these args" and "Construct an object of type T with these 
args". The problem is it's not very intuitive in usage.


Perhaps "call" for functions and "make" for objects are better. 
If we add these to std.experimental.functional and 
std.experimental.conv and they get a lot of usage we might make 
a small change to the language.



Andrei


would'nt it be possible to take the type as a runtime param
and support struct, class and all callables?
e.g.

(&fun).args!(a=>5, b=>6);

auto st = SomeStruct().args!(a=>3);

auto sc = new SomeClass().args!(x => 20, y => 50);

(&sc.fun).args!(x => 6);

or named and positional args
(&sc.fun).args!(x => 9)(3, 6);


Re: foo => "bar" key/value literals in D!

2016-06-11 Thread ArturG via Digitalmars-d-announce
On Saturday, 11 June 2016 at 15:46:59 UTC, Vladimir Panteleev 
wrote:


Taking an address creates a function pointer, which loses the 
argument names. (Doesn't it?)


unfortunatly yes, but it works as a struct or class initializer
https://dpaste.dzfl.pl/6aad852aea90


Re: Project Highlight: Derelict

2017-06-26 Thread arturg via Digitalmars-d-announce

On Monday, 26 June 2017 at 14:30:13 UTC, Mike Parker wrote:
I've just published a wall of text about Derelict. I don't 
think I've ever written so much about it in one sitting, so it 
was a fun post to write. As well as (the reminder of how fast 
time is slipping away aside) a nice walk down memory lane.


The Blog:
https://dlang.org/blog/2017/06/26/project-highlight-derelict/

Reddit:
https://www.reddit.com/r/programming/comments/6jldos/derelict_a_collection_of_d_bindings_to_c_libraries/


s/you don't tend find/you don't tend to find/

s/As the D has evolved/As D has evolved/


Re: Enum and Function Parameters Attributes -- No DIP Required

2018-04-12 Thread arturg via Digitalmars-d-announce

On Thursday, 12 April 2018 at 08:28:17 UTC, Mike Parker wrote:


Around the same time, a Pull Request was created to implement 
support for UDAs on function parameters [4]. In the comment 
thread for this PR, Andrei said that he and Walter "agree this 
can be integrated without a DIP." When he realized a DIP had 
already been submitted, he wanted to approve it "without too 
much paperwork."


[4] https://github.com/dlang/dmd/pull/7576


will templates be supported?
dont know, maybe something like this example:

void test(T)(T t) { }
void test2(Args...)(Args args) { }
void main()
{
// uda declaration as a ct-param
test!(@(1) int)(1);
test2!(@(1) int, @(2) string)(1, "test");
test!(@(1))(1); // inferred type but provided uda?
1.test!(@(1) int);
1.test2!(@(1) int, @(2) string)("test");
1.test!(@(1)); // inferred type but provided uda?

// or alternatively as a rt-param
test(@(1) 1); // inferred type but provided uda?
(@(1) 1).test;
test2(@(1) 1, @(2) "test");
test!(int)(@(1) 1);
test2!(int, string)(@(1) 1, @(2) "test");
}