On 1/31/15 1:10 AM, Martin Nowak wrote:
Thanks for this code, it's a lot nicer and simpler than mine. -- Andrei
So, pull request for std.array and reverting the dollar thingie?
Problem solved?
This looks like the way to go. I apologize to the community for the
indecision shown. -- Andrei
Thanks for this code, it's a lot nicer and simpler than mine.
-- Andrei
So, pull request for std.array and reverting the dollar thingie?
Problem solved?
On 1/31/2015 8:08 AM, Andrei Alexandrescu wrote:
On 1/31/15 1:10 AM, Martin Nowak wrote:
Thanks for this code, it's a lot nicer and simpler than mine. -- Andrei
So, pull request for std.array and reverting the dollar thingie?
Problem solved?
This looks like the way to go. I apologize to the
On 1/30/2015 6:54 AM, Andrei Alexandrescu wrote:
On 1/30/15 1:29 AM, Foo wrote:
Thanks for this code, it's a lot nicer and simpler than mine. -- Andrei
I'm going to swipe this for an upcoming presentation I'm doing. Thanks, Foo!
On Friday, 30 January 2015 at 22:21:15 UTC, Walter Bright wrote:
On 1/30/2015 6:54 AM, Andrei Alexandrescu wrote:
On 1/30/15 1:29 AM, Foo wrote:
Thanks for this code, it's a lot nicer and simpler than mine.
-- Andrei
I'm going to swipe this for an upcoming presentation I'm doing.
Thanks,
On 1/30/15 1:29 AM, Foo wrote:
@nogc
@safe
T[n] s(T = Args[0], size_t n = Args.length, Args...)(auto ref Args args)
pure nothrow {
return [args];
}
@nogc
@safe
T[n] s(T, size_t n)(auto ref T[n] values) pure nothrow {
return values;
}
void main() {
pragma(msg, typeof(s(1, 2,
On Friday, 30 January 2015 at 08:54:55 UTC, bearophile wrote:
Daniel Kozák:
No, it makes more bugs possible
// this is compile error so its ok
int[MUST_HAVE_FIVE_ITEMS] a=[1,2,3,5];
// Error: mismatched array lengths, 5 and 4
Have you tried to compile my code? It doesn't give an error.
Andrei Alexandrescu:
No, we need to define a function for that - please file an
enhancement request, thanks. -- Andrei
No, the enhancement is in Bugzilla since lot of time. But it's
for a built-in syntax. A function name is too much long, and when
the inlining is switched off it makes the
deadalnix:
- added optimization to promote them on heap. Thing like
int[2] = [1, 2] can trivially avoid GC allocation.
See my usage examples (think of the examples as not having the
s suffix):
void main() {
// Some imports here.
foo([[1, 2]s, [3, 4]]s);
auto t1 = tuple([1,
On Friday, 30 January 2015 at 01:08:31 UTC, bearophile wrote:
The D type inference for array literals is now more flexible:
void main() {
auto[$][$] m1 = [[1, 2], [3, 4], [5, 6]];
pragma(msg, typeof(m1)); // int[2][3]
const auto[string] aa1 = [red: 1, blue: 2];
pragma(msg,
Daniel Kozák:
No, it makes more bugs possible
// this is compile error so its ok
int[MUST_HAVE_FIVE_ITEMS] a=[1,2,3,5];
// Error: mismatched array lengths, 5 and 4
Have you tried to compile my code? It doesn't give an error.
Bye,
bearophile
On Friday, 30 January 2015 at 07:37:07 UTC, Daniel Kozák wrote:
V Fri, 30 Jan 2015 01:08:30 +
bearophile via Digitalmars-d digitalmars-d@puremagic.com
napsáno:
It helps avoid bugs like:
int[5] a = [1,2,4,5];
No, it makes more bugs possible
// this is compile error so its ok
The D type inference for array literals is now more flexible:
void main() {
auto[$][$] m1 = [[1, 2], [3, 4], [5, 6]];
pragma(msg, typeof(m1)); // int[2][3]
const auto[string] aa1 = [red: 1, blue: 2];
pragma(msg, typeof(aa1)); // const(int)[string]
}
It helps avoid bugs like:
On 1/29/15 5:08 PM, bearophile wrote:
What's missing is a handy and compiler-efficient syntax to create value
array literals. Some persons have proposed the []s syntax:
No, we need to define a function for that - please file an enhancement
request, thanks. -- Andrei
On Friday, 30 January 2015 at 02:08:23 UTC, Andrei Alexandrescu
wrote:
On 1/29/15 5:08 PM, bearophile wrote:
What's missing is a handy and compiler-efficient syntax to
create value
array literals. Some persons have proposed the []s syntax:
No, we need to define a function for that - please
V Fri, 30 Jan 2015 01:08:30 +
bearophile via Digitalmars-d digitalmars-d@puremagic.com napsáno:
It helps avoid bugs like:
int[5] a = [1,2,4,5];
No, it makes more bugs possible
// this is compile error so its ok
int[MUST_HAVE_FIVE_ITEMS] a=[1,2,3,5];
// Error: mismatched array
16 matches
Mail list logo