Re: Simple casting?

2019-11-27 Thread ixid via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 14:40:56 UTC, Timon Gehr wrote: On 27.11.19 11:43, ixid wrote: On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: import std; void main(){     int[] x=[1,1,2,3,4,4];     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;     writeln(y); } This

Re: Simple casting?

2019-11-27 Thread ixid via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: import std; void main(){ int[] x=[1,1,2,3,4,4]; int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; writeln(y); } This stuff is a nightmare for less experienced users like myself, I wish there were a single function

Re: No UFCS with nested functions?

2019-11-05 Thread ixid via Digitalmars-d-learn
On Monday, 4 November 2019 at 20:46:41 UTC, H. S. Teoh wrote: On Mon, Nov 04, 2019 at 07:51:26PM +, Tobias Pankrath via Digitalmars-d-learn wrote: Why does the following not work? It works, if I move the 'prop' out of 'foo'. UFCS is only supported for module-level functions, as far as I

Re: Accuracy of floating point calculations

2019-10-29 Thread ixid via Digitalmars-d-learn
On Tuesday, 29 October 2019 at 16:11:45 UTC, Daniel Kozak wrote: On Tue, Oct 29, 2019 at 5:09 PM Daniel Kozak wrote: If you use gdc or ldc you will get same results as c++, or you can use C log directly: import std.stdio; import std.math : pow; import core.stdc.math; void main() {

Re: Automatic variable declaration

2018-08-16 Thread ixid via Digitalmars-d
On Wednesday, 15 August 2018 at 14:58:40 UTC, Everlast wrote: Many times one must create a variable before a function call: int x = 3; foo(x); writeln(x); and this is fraught with problems such as dependencies(move or change the second line and one has to validate how the first line

Re: Enum and CTFE function call

2018-08-14 Thread ixid via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:38:16 UTC, Everlast wrote: etc Thanks all for the comprehensive responses. I was not clearly separating CTFE and the compilation of the function in thinking about it. Much clearer now.

Re: Enum and CTFE function call

2018-08-14 Thread ixid via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 09:12:30 UTC, ixid wrote: This will not compile as it says n is not known at compile time... This does work if 'value' is changed to immutable and fun to accept it. So it still seems like a missed opportunity as enum shouldn't be able to change either.

Enum and CTFE function call

2018-08-14 Thread ixid via Digitalmars-d-learn
This will not compile as it says n is not known at compile time: auto fun(int n) { static foreach(i;0..n) mixin(i.to!string ~ ".writeln;"); return; } enum value = 2; void main() { fun(value); } But making it a template parameter fun(int n)() and

Re: Sutter's ISO C++ Trip Report - The best compliment is when someone else steals your ideas....

2018-07-03 Thread ixid via Digitalmars-d
On Tuesday, 3 July 2018 at 04:54:46 UTC, Walter Bright wrote: So, I have finally convinced the C++ world about that! Now if I can only convince the D world :-) (I'm referring to the repeated and endless threads here where people argue that yes, they can recover from programming bugs!) It

Re: Found on proggit: simple treap language benchmark, includes D

2018-05-21 Thread ixid via Digitalmars-d
On Saturday, 19 May 2018 at 15:09:38 UTC, Joakim wrote: D does well, comes in second on Mac/Win/linux: https://github.com/frol/completely-unscientific-benchmarks https://www.reddit.com/r/programming/comments/8jbfa7/naive_benchmark_treap_implementation_of_c_rust/ Can any experts improve this

Re: Benchmark Game

2018-05-17 Thread ixid via Digitalmars-d
On Thursday, 17 May 2018 at 08:51:39 UTC, rikki cattermole wrote: On 17/05/2018 8:50 PM, Chris wrote: For what it's worth, I came across this website: https://benchmarksgame-team.pages.debian.net/benchmarksgame/ D is not there. Anyone interested, if it's worth it? It isn't happening

Re: Infer return type from assignment

2018-04-11 Thread ixid via Digitalmars-d-learn
On Wednesday, 11 April 2018 at 14:33:06 UTC, Adam D. Ruppe wrote: On Wednesday, 11 April 2018 at 14:26:53 UTC, ixid wrote: Is it possible to infer a template's return type from what it's assigned to? If not is this a difficult or worthless feature to add? Not really. The function call needs

Infer return type from assignment

2018-04-11 Thread ixid via Digitalmars-d-learn
Is it possible to infer a template's return type from what it's assigned to? If not is this a difficult or worthless feature to add? OUT fun(IN, OUT)(IN value) { return value.to!OUT; } void main() { float a = 5.0; int b = fun(a); }

Re: Tuple DIP

2018-03-15 Thread ixid via Digitalmars-d
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote: auto (a, b) = (1, 2); For the assignment and unpacking grammar why not adopt the more streamlined Go syntax? auto a, b = 1, 2; // Creates two new variables with the values 1 and 2 auto c, d = 1, (2,3); // A normal variable and

Re: See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 14:50:05 UTC, ixid wrote: On Tuesday, 6 March 2018 at 14:37:27 UTC, Steven Schveighoffer wrote: Now, there aren't actually docs for Transposed, but you can find it if you look at std.range.transposed: https://dlang.org/phobos/std_range.html#transposed -Steve

Re: See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 14:37:27 UTC, Steven Schveighoffer wrote: Now, there aren't actually docs for Transposed, but you can find it if you look at std.range.transposed: https://dlang.org/phobos/std_range.html#transposed -Steve Thanks, I had found that but that is not an explanation

See docs compiler message

2018-03-06 Thread ixid via Digitalmars-d-learn
/opt/compilers/dmd2/include/std/algorithm/iteration.d(663): Deprecation: function `std.range.Transposed!(string[], cast(TransverseOptions)0).Transposed.save` is deprecated - This function is incorrect and will be removed November 2018. See the docs for more details. If it's going to say 'See

Re: dip1000 state

2018-03-03 Thread ixid via Digitalmars-d
On Saturday, 3 March 2018 at 09:04:04 UTC, Walter Bright wrote: On 3/2/2018 10:48 PM, Manu wrote: I've been arguing for DIP1000 (or something very much like it) for almost 10 years. It's one of the small handful of issues that lead me to the forum in the first place. 'Patience' might not be

Re: short s, t; t = -s: no (longer) works: Deprecation: integral promotion not done for -s, use

2018-02-24 Thread ixid via Digitalmars-d-learn
On Saturday, 24 February 2018 at 20:07:04 UTC, kdevel wrote: I don't get the point of the deprecation message: --- intprom.d import std.stdio; void main () { short s, t; t = -s; } --- $ dmd intprom.d intprom.d(6): Deprecation: integral promotion not done for -s, use

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ixid via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:42:56 UTC, Simen Kjærås wrote: On Wednesday, 21 February 2018 at 14:29:38 UTC, ixid wrote: I do not understand what is happening here, I tried to wrote what I thought would be the answer. If someone could explain that would be great. I wrote this code:

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ixid via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:11:10 UTC, ParticlePeter wrote: struct Foo(T) { T bar; this(S)(S s) { bar = convert(s); } } auto foo = Foo!int(some_float); this works because S is deduced as typeof(some_float), but how would I instantiate the struct without relying on auto

Re: import strangeness with std.stdio.write

2018-02-13 Thread ixid via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 13:52:37 UTC, rikki cattermole wrote: write exists in both, writeln exists only in std.stdio. Use named imports to pick which write you want. It does seem a little silly to have a name clash with such a commonly used function. Would it not be better to rename

Re: A betterC base

2018-02-08 Thread ixid via Digitalmars-d
On Thursday, 8 February 2018 at 15:51:38 UTC, Adam D. Ruppe wrote: On Thursday, 8 February 2018 at 15:43:01 UTC, ixid wrote: That's been said over and over and the message has not gotten through. It is almost never said! We always play by their terms and implicitly concede by saying "but we

Re: A betterC base

2018-02-08 Thread ixid via Digitalmars-d
On Thursday, 8 February 2018 at 14:56:31 UTC, Adam D. Ruppe wrote: ooh better last sentence D's GC implementation follows in the footsteps of industry giants without compromising experts' ability to realize maximum potential from the machine. That's been said over and over and the message

A betterC base

2018-02-08 Thread ixid via Digitalmars-d
How difficult would it be for D at this point to move towards a pay for what you use system that out of the box is betterC and requires the garbage collector to be explicitly imported? It feels like D has not overcome at least two major issues in the public mind, the built-in GC and, more

Re: Community Rant

2017-08-22 Thread ixid via Digitalmars-d
On Tuesday, 22 August 2017 at 15:14:33 UTC, Jonathan Shamir wrote: various. Out of interest did you pick up D before or after joining the start up? If before did you introduce D to them or were they already using it?

Re: jai-like CTFE string formating

2017-08-12 Thread ixid via Digitalmars-d
On Saturday, 12 August 2017 at 11:47:10 UTC, Stefan Koch wrote: Whereas the following alternative takes 20 ms : { import ctfe_utils; pragma(msg, format_jai("Hello % % % % % % % % %", " I ", " just", " have" , " to", " concat", " a lot", " of", " strings ...", 9)); } see for yourself:

Re: Deprecate real

2017-06-30 Thread ixid via Digitalmars-d
On Friday, 30 June 2017 at 10:49:19 UTC, Stefan Koch wrote: On Friday, 30 June 2017 at 10:44:41 UTC, ixid wrote: On Friday, 30 June 2017 at 10:26:03 UTC, Nicholas Wilson wrote: On Friday, 30 June 2017 at 10:07:44 UTC, ixid wrote: Are there any reasons not to put real on the path to removal?

Re: Deprecate real

2017-06-30 Thread ixid via Digitalmars-d
On Friday, 30 June 2017 at 10:26:03 UTC, Nicholas Wilson wrote: On Friday, 30 June 2017 at 10:07:44 UTC, ixid wrote: Are there any reasons not to put real on the path to removal? The hardware is deprecated by both Intel and AMD and it seems like an unnecessary source of confusion. Don't

Deprecate real

2017-06-30 Thread ixid via Digitalmars-d
Are there any reasons not to put real on the path to removal? The hardware is deprecated by both Intel and AMD and it seems like an unnecessary source of confusion.

Re: dmd -betterC

2017-06-20 Thread ixid via Digitalmars-d
On Tuesday, 20 June 2017 at 09:21:05 UTC, Walter Bright wrote: On 6/20/2017 2:00 AM, ixid wrote: How far away from a purely additive, pay for what we use situation are we? It would seem like D should be BetterC out of the box, without needing any switches and as you add and use specific

Re: dmd -betterC

2017-06-20 Thread ixid via Digitalmars-d
On Tuesday, 20 June 2017 at 01:51:26 UTC, Walter Bright wrote: Is getting a whole lot better: https://github.com/dlang/dmd/pull/6918 You can now build D executables that do not link in anything from Phobos - only from the standard C library. How far away from a purely additive, pay for what

Re: I'm Dumpin' it!

2017-05-12 Thread ixid via Digitalmars-d
On Friday, 12 May 2017 at 12:55:37 UTC, Seb wrote: Hi all, last year there has been a discussion about adding a utility method for easily dumping variables during debugging to Phobos [3971]. The effort stalled and after a couple of months I tried to reboot it [4318]. Now this PR got stalled

Re: Is it acceptable to not parse unittest blocks when unittests are disabled ?

2017-03-30 Thread ixid via Digitalmars-d
On Thursday, 30 March 2017 at 06:53:47 UTC, XavierAP wrote: On Wednesday, 29 March 2017 at 11:16:28 UTC, deadalnix wrote: Is that an acceptable tradeof ? I would consider this harmful... The spec already states this about unit tests, so I'd guess the decision was taken in the past

Re: Why don't you advertise more your language on Quora etc ?

2017-03-02 Thread ixid via Digitalmars-d
On Wednesday, 1 March 2017 at 18:37:46 UTC, Nick Sabalausky (Abscissa) wrote: On 03/01/2017 12:25 PM, Jack Stouffer wrote: I agree. We have a lot to improve in terms of marketing. Mainly our messaging is jumbled. Rust = memory safety Go = the best runtime around D = everything I guess? And

Re: What about this logo ":D" to advertise the D language ?

2017-03-02 Thread ixid via Digitalmars-d
On Thursday, 2 March 2017 at 09:05:43 UTC, Jared Jeffries wrote: I'm not completely joking ;) D deserves a lot more fame, because it really allows programmers to "develop with a smile", so maybe the logo and slogan should reflect it... With D you can get the job done, as with C++, Java, C#,

Re: A better way to deal with overloading?

2017-01-27 Thread ixid via Digitalmars-d
On Friday, 27 January 2017 at 09:47:48 UTC, Bauss wrote: On Thursday, 26 January 2017 at 00:02:03 UTC, Profile Anaysis wrote: Many times we pass compound types(non-primitives) as arguments to functions. [...] This is going to be a no from me. It's just another syntactic sugar that doesn't

Re: alias and UFCS

2017-01-24 Thread ixid via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 20:51:49 UTC, Stefan Koch wrote: On Tuesday, 24 January 2017 at 16:41:12 UTC, ixid wrote: On Tuesday, 24 January 2017 at 16:27:50 UTC, ixid wrote: On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote: On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:

Re: alias and UFCS

2017-01-24 Thread ixid via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 16:27:50 UTC, ixid wrote: On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote: On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote: This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for

Re: alias and UFCS

2017-01-24 Thread ixid via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote: On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote: This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). The alias rules

Re: module std.stream is deprecated - Will be removed by phobos version 2.070

2017-01-23 Thread ixid via Digitalmars-d
On Friday, 11 September 2015 at 21:16:06 UTC, Brian Schott wrote: On Friday, 11 September 2015 at 20:29:56 UTC, Vladimir Panteleev wrote: Apparently it was decided at DConf 2015 to remove std.stream and friends from Phobos. Kill it with fire. Speaking of killing things with fire (OT) -

Re: Red Hat's issues in considering the D language

2016-12-21 Thread ixid via Digitalmars-d
On Tuesday, 20 December 2016 at 23:08:28 UTC, Andrei Alexandrescu wrote: Hello, a few engineers at Red Hat are taking a look at using the D language on the desktop and have reached out to us. They have created a list of issues. We are on the top-level ones, and of course would appreciate any

Re: Nov 16 - Memory Safety and the D Programming Language

2016-11-21 Thread ixid via Digitalmars-d-announce
On Sunday, 20 November 2016 at 22:34:26 UTC, Walter Bright wrote: On 11/14/2016 1:39 AM, qznc wrote: On Monday, 14 November 2016 at 06:57:07 UTC, Walter Bright wrote: · Follow our YouTube channel. So, there will be a recording? Great! Unfortunately, the audio was lost 18 minutes in. Looks

Re: Why doesn't std.variant.visit automatically call the provided delegates?

2016-11-05 Thread ixid via Digitalmars-d
On Saturday, 5 November 2016 at 20:22:13 UTC, Adam D. Ruppe wrote: On Saturday, 5 November 2016 at 20:15:14 UTC, Kapps wrote: That feels like it should be a compiler warning. I'm now of the opinion that the {} delegates should be deprecated (instead use () {} delegates)... this comes up a

Re: If Statement with Declaration

2016-11-04 Thread ixid via Digitalmars-d
On Friday, 4 November 2016 at 00:04:28 UTC, mogu wrote: Introducing a block is not intuitive and cause an identation. How is using a block to produce a sub-scope not intuitive? That's using a standard feature to do exactly what it is supposed to do.

Re: consequences of removing semicolons in D like in Python

2016-09-17 Thread ixid via Digitalmars-d
On Saturday, 17 September 2016 at 11:59:53 UTC, cym13 wrote: Note how a leading dot means “global scope” but a dot after something means UFCS or method/attribute. What should this program do? If it is akin to “auto i = [1, 2, 3]; .filterEven();” then i is an int[] and the program prints

Re: C# 7 Features - Tuples

2016-08-26 Thread ixid via Digitalmars-d
On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :) This is

Re: Compiling DMD on Windows: A journey of mystery and madness

2016-08-23 Thread ixid via Digitalmars-d
On Monday, 22 August 2016 at 02:34:37 UTC, Walter Bright wrote: On 8/21/2016 12:12 PM, Andrei Alexandrescu wrote: How does that work? Aren't step-by-step documents "how to do this on Posix" and "how to do this for Windows" best tested in one environment at a time? I know when I'm following

Re: Why D isn't the next "big thing" already

2016-07-27 Thread ixid via Digitalmars-d-learn
On Wednesday, 27 July 2016 at 00:52:30 UTC, Gorge Jingale wrote: So, you can see D as a sort of dried up waste land desert with a few nice palm trees growing here and there and a few scorpions. C++, say, is a very lush forest with many tree dwelling monkeys. Which environment would you rather

Re: DIP: Tail call optimization

2016-07-12 Thread ixid via Digitalmars-d-announce
On Monday, 11 July 2016 at 11:19:59 UTC, Dicebot wrote: D language authors don't want to enforce any code of conduct or moderation in the newsgroup which means certain personas have to be simply ignored. This is not a policy that will scale well. Ketmar's behaviour was badly out of line.

Re: DIP: Tail call optimization

2016-07-10 Thread ixid via Digitalmars-d-announce
On Sunday, 10 July 2016 at 06:17:08 UTC, ketmar wrote: your DIP is aimed for is brain-damaged coders who are not able to understand how programs work (and why "scope(exit)" may prevent TCO). it won't help anyone. sorry. This is really unacceptablely rude. Step away from the computer and cool

Re: Andrei's list of barriers to D adoption

2016-06-06 Thread ixid via Digitalmars-d
On Monday, 6 June 2016 at 09:09:13 UTC, Mike Parker wrote: Where does this impression come from that Windows is a second-class citizen? So... what's the problem? I'm saying things like that is where the impression can come from. It's not a problem now.

Re: Andrei's list of barriers to D adoption

2016-06-06 Thread ixid via Digitalmars-d
On Monday, 6 June 2016 at 07:44:22 UTC, Mike Parker wrote: Where does this impression come from that Windows is a second-class citizen? 64-bit support seemed to take forever to reach Windows.

Re: Why I won't fix phobos bugs anymore

2016-06-03 Thread ixid via Digitalmars-d
On Friday, 3 June 2016 at 05:51:02 UTC, Pie? wrote: Also, Sisyphus must not have been too crafty! If he spend all that time digging out the hill then it would have been lower in gravity and he wouldn't have to carry it for eternity... just give it a nudge and it would roll down. Hen he could

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?

Re: Split general into multiple threads

2016-05-27 Thread ixid via Digitalmars-d
On Thursday, 26 May 2016 at 17:07:54 UTC, Seb wrote: I think we all agree that general is having to much traffic and according to CyberShadow [1] this again is just an approval issue, however I expect this a bit controversial, so please no OT! Only other category proposals. Proposed

Re: Our Sister

2016-05-26 Thread ixid via Digitalmars-d
On Thursday, 26 May 2016 at 16:20:37 UTC, Adam D. Ruppe wrote: On Thursday, 26 May 2016 at 16:11:22 UTC, Andrei Alexandrescu wrote: I've been working on RCStr (endearingly pronounced "Our Sister") You really should actually mention RCStr in the subject line so people overwhelmed with the

Re: Idea: swap with multiple arguments

2016-05-24 Thread ixid via Digitalmars-d
On Tuesday, 24 May 2016 at 01:18:05 UTC, Jonathan M Davis wrote: Hmmm. And I would have assumed that it rotated in the other direction. This is really going to need a very specific name like rotateLeft or rotateRight in order for it not to be error-prone. - Jonathan M Davis Why would you

Re: OpenGL with D tutorials

2016-05-22 Thread ixid via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:55:47 UTC, Guillaume Piolat wrote: On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)?

OpenGL with D tutorials

2016-05-22 Thread ixid via Digitalmars-d-learn
What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get errors, files that are no longer included are needed (dgl)? and deprecation messages.

Re: Always false float comparisons

2016-05-18 Thread ixid via Digitalmars-d
On Wednesday, 18 May 2016 at 11:38:23 UTC, Manu wrote: That's precisely the suggestion; that compile time execution of a given type mirror the runtime, that is, matching precisions in this case. ...within reason; as Walter has pointed out consistently, it's very difficult to be PERFECT for

Re: Always false float comparisons

2016-05-18 Thread ixid via Digitalmars-d
On Wednesday, 18 May 2016 at 08:55:03 UTC, Walter Bright wrote: On 5/18/2016 1:30 AM, Ethan Watson wrote: You're also asking for a mode where the compiler for one machine is supposed to behave like hand-coded assembler for another machine with a different instruction set. Actually, I'm

Re: dpaste and warning upon leaving page

2016-05-12 Thread ixid via Digitalmars-d
On Wednesday, 11 May 2016 at 11:27:44 UTC, nazriel wrote: On Tuesday, 10 May 2016 at 16:39:05 UTC, Anonymouse wrote: I just had a PEBCAK moment where I was composing a large-ish snippet on dpaste, then accidentally left the page by clicking the back button on my mouse. Going back to the page I

Re: Killing the comma operator

2016-05-10 Thread ixid via Digitalmars-d
On Tuesday, 10 May 2016 at 09:52:07 UTC, Mathias Lang wrote: Do you like comma expressions, and think its presence in the language is more pro than con ? Kill it with fire and hopefully we can have pretty tuple syntax like Swift and Go's.

Re: So, to print or not to print?

2016-04-26 Thread ixid via Digitalmars-d
On Tuesday, 26 April 2016 at 03:13:22 UTC, Jonathan M Davis wrote: On Tuesday, April 26, 2016 01:44:07 Jack Stouffer via Digitalmars-d wrote: On Monday, 25 April 2016 at 19:35:04 UTC, Andrei Alexandrescu wrote: > https://github.com/dlang/phobos/pull/3971 I really don't see the utility of the

Re: So what does (inout int = 0) do?

2016-04-15 Thread ixid via Digitalmars-d
On Friday, 15 April 2016 at 03:10:12 UTC, Andrei Alexandrescu wrote: We want Phobos to be beautiful, a prime example of good D code. Admittedly, it also needs to be very general and efficient, which sometimes gets in the way. But we cannot afford an accumulation of mad tricks to obscure the

Re: uniform initialization in D (as in C++11): i{...}

2016-04-05 Thread ixid via Digitalmars-d
On Tuesday, 5 April 2016 at 09:22:12 UTC, Jin wrote: On Tuesday, 5 April 2016 at 05:39:25 UTC, Timothee Cour wrote: what's D's answer for C++11's uniform initialization [1] which allows DRY code? Could we have this: struct A{ int a; int b; } A fun(A a, int b) { if(b==1) return

Re: foreach UFCS

2016-03-31 Thread ixid via Digitalmars-d-learn
On Thursday, 31 March 2016 at 13:48:27 UTC, Adam D. Ruppe wrote: It is trying to look up a name i in global scope, and calling writeln on it. This is why the .name syntax exists: so you can bypass local variables with the same name when trying to access a global. It would compile if you put

foreach UFCS

2016-03-31 Thread ixid via Digitalmars-d-learn
What is going on with UFCS and foreach? foreach(i;0..5).writeln; This prints five line breaks. foreach(i;0..5).i.writeln; This will not compile. foreach(i;0..5).writeln(i); This writes out 1 to 4 on separate lines. Is this supposed to work? I thought a.b would be rewritten to b(a) with

Re: Speed kills

2016-03-08 Thread ixid via Digitalmars-d
On Monday, 15 February 2016 at 13:51:38 UTC, ixid wrote: Every time there is a D thread on reddit it feels like the new user is expecting mind-blowing speed from D. https://www.reddit.com/r/programming/comments/45v03g/porterstemmerd_an_implementation_of_the_porter/ This is the most recent one

Re: Simple performance question from a newcomer

2016-02-23 Thread ixid via Digitalmars-d-learn
On Tuesday, 23 February 2016 at 14:07:22 UTC, Marc Schütz wrote: On Tuesday, 23 February 2016 at 11:10:40 UTC, ixid wrote: We really need to standard algorithms to be fast and perhaps have separate ones for perfect technical accuracy. While I agree with most of what you're saying, I don't

Re: Simple performance question from a newcomer

2016-02-23 Thread ixid via Digitalmars-d-learn
On Monday, 22 February 2016 at 15:43:23 UTC, dextorious wrote: I do have to wonder, however, about the default settings of dub in this case. Having gone through its documentation, I might still not have guessed to try the compiler options you provided, thereby losing out on a 2-3x performance

Re: DigitalWhip

2016-02-18 Thread ixid via Digitalmars-d-announce
On Saturday, 13 February 2016 at 21:10:11 UTC, Adam D. Ruppe wrote: We should run benchmarks with bounds checking enabled to better reflect real world results. Yes, it might "lose" to C Like for like comparisons are the best approach, making it clear what a given result is for. The most

Re: Head Const

2016-02-18 Thread ixid via Digitalmars-d
On Thursday, 18 February 2016 at 11:57:59 UTC, Jonathan M Davis wrote: The problem that folks frequently want to be able to solve that they simply cannot solve >with D's const (and headconst wouldn't help) is that they want to be able to pass an object >to a function that takes it as const or

Speed kills

2016-02-15 Thread ixid via Digitalmars-d
Every time there is a D thread on reddit it feels like the new user is expecting mind-blowing speed from D. https://www.reddit.com/r/programming/comments/45v03g/porterstemmerd_an_implementation_of_the_porter/ This is the most recent one where John Colvin provided some pointers to speed it up

Re: Just because it's a slow Thursday on this forum

2016-02-12 Thread ixid via Digitalmars-d
On Friday, 12 February 2016 at 03:18:47 UTC, Nick Sabalausky wrote: I'd be perfectly happy to have it, particularly if it had a less confusing name, but can definitely see it being debatable whether it really is Phobos-worthy. Andrei has previously expressed a desire for a big standard

Re: Weird issue with std.range.iota.length

2016-02-12 Thread ixid via Digitalmars-d
On Friday, 12 February 2016 at 15:59:09 UTC, Jonathan M Davis wrote: It would be far better IMHO to just do a check in iota and throw a RangeError if the length wouldn't fit in size_t. Having length ever be anything other than size_t is just going to cause problems with other ranges. On 32-bit

Re: Just because it's a slow Thursday on this forum

2016-02-10 Thread ixid via Digitalmars-d
On Tuesday, 9 February 2016 at 18:02:50 UTC, Andrei Alexandrescu wrote: On 02/09/2016 10:34 AM, ixid wrote: An alternate solution is liable to be too clever for its own good. Everybody and their cat understands string concatenation. What we need here is better tactical tools, e.g. a simple

Re: Just because it's a slow Thursday on this forum

2016-02-09 Thread ixid via Digitalmars-d
On Tuesday, 9 February 2016 at 12:46:34 UTC, Jakob Ovrum wrote: I'm not a fan of non-trivial string mixins except in extenuating circumstances. This is something Steven Schveighoffer commented on in these discussions as well. As this is a fundamental D feature and it's currently rather

Re: print function

2016-02-05 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 22:13:36 UTC, Ola Fosheim Grøstad wrote: Well, it is probably not the best point in time to have absolute beginners use D anyway. That is a ridiculous thing to say and a great way of ensuring a language dies. Good starting resources help everyone.

Re: print function

2016-02-04 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 11:04:23 UTC, cym13 wrote: On Thursday, 4 February 2016 at 10:18:35 UTC, ixid wrote: Do you think your knowledge and experience is a good model for how a new user who hasn't done much if any programming before would approach this? A design choice had to be

Re: print function

2016-02-04 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 10:05:15 UTC, Jonathan M Davis wrote: I would normally expect someone to do that with writefln, which would be cleaner. e.g. writefln("%s %s %s %s", a, b, c, d); Personally, I've never felt the need for a function like you're describing. - Jonathan M Davis

Re: print function

2016-02-04 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 13:46:46 UTC, Dejan Lekic wrote: On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote: It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. There are many implementations of

Re: print function

2016-02-04 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 17:34:33 UTC, Artur Skawina wrote: On 02/04/16 16:32, Artur Skawina wrote: but that seems too expensive, when the use is just in toy programs and debugging. I hadn't really considered the relative cost-benefit, it's just a habit to try to hardcode things at

print function

2016-02-03 Thread ixid via Digitalmars-d-learn
It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print.

Re: print function

2016-02-03 Thread ixid via Digitalmars-d-learn
On Thursday, 4 February 2016 at 00:30:03 UTC, cym13 wrote: On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote: It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. Sounds way too redundant to me. Normally

Re: reduce -> fold?

2016-01-29 Thread ixid via Digitalmars-d
On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu wrote: As has been discussed before there's been discussion about std.algorithm.reduce taking the "wrong" order of arguments (its definition predates UFCS). I recall the conclusion was there'd be subtle ambiguities if we worked

foreach change for multi-dimensional data

2016-01-28 Thread ixid via Digitalmars-d-learn
This is an idle thought hence putting it on the Learn-level forum. An idea struck me for foreach to make working with more complicated data types or heavily nested data easier. uint[][] a = [[1,2,3],[4,5,6]]; foreach(uint[] b; a) b.writeln; At

Re: foreach change for multi-dimensional data

2016-01-28 Thread ixid via Digitalmars-d-learn
On Thursday, 28 January 2016 at 15:38:20 UTC, Ali Çehreli wrote: On 01/28/2016 05:33 AM, ixid wrote: > This is an idle thought hence putting it on the Learn-level forum. An > idea struck me for foreach to make working with more complicated data > types or heavily nested data easier. > > >

Re: Collapsing n-dimensional array to linear (1 dimensional)

2016-01-25 Thread ixid via Digitalmars-d-learn
On Monday, 25 January 2016 at 08:31:14 UTC, abad wrote: On Monday, 25 January 2016 at 02:27:57 UTC, Solomon E wrote: On Saturday, 23 January 2016 at 07:57:55 UTC, Ali Çehreli Ruby's Array class includes this sort method for flattening and for me it was surprisingly useful, for instance when it

Re: [dlang.org] Let's talk about the logo

2016-01-22 Thread ixid via Digitalmars-d
On Friday, 22 January 2016 at 19:53:32 UTC, ronaldmc wrote: On Thursday, 21 January 2016 at 23:46:26 UTC, anonymous wrote: The logo is repeatedly being called out as a weak spot of the D brand. But so far Walter has been adamant about keeping it the way it is. I don't want to start a war,

Re: [dlang.org] Let's talk about the logo

2016-01-22 Thread ixid via Digitalmars-d
On Thursday, 21 January 2016 at 23:46:26 UTC, anonymous wrote: The logo is repeatedly being called out as a weak spot of the D brand. But so far Walter has been adamant about keeping it the way it is. I certainly agree the logo is weak, to me the planets look more like a bad lens flare

Re: Wishlist for D

2015-12-11 Thread ixid via Digitalmars-d
On Friday, 11 December 2015 at 10:04:22 UTC, Andrea Fontana wrote: On Tuesday, 1 December 2015 at 16:48:00 UTC, Suliman wrote: Right place is write here My wishes: - Less flamewars. - A heavy template-based image manipulation library (like antigrain for c++) As forums go this one is very

Re: D compiler daily downloads at an all-time high

2015-11-16 Thread ixid via Digitalmars-d-announce
On Monday, 16 November 2015 at 15:20:51 UTC, Andrei Alexandrescu wrote: That's a new all-times high ever since we started measuring on January 02, 2013. The previous record, 1630 average daily downloads, was established in the four weeks ending November 17, 2014. Andrei That looks more

Re: RFC in Comparison between Rust, D and Go

2015-11-12 Thread ixid via Digitalmars-d
On Wednesday, 11 November 2015 at 10:49:02 UTC, Ola Fosheim Grøstad wrote: I wish you would streamline template definitions even more in D, though. What were you thinking?

Re: Preventing implicit conversion

2015-11-05 Thread ixid via Digitalmars-d-learn
On Thursday, 5 November 2015 at 05:41:46 UTC, Jonathan M Davis wrote: On Wednesday, November 04, 2015 21:22:02 ixid via Digitalmars-d-learn wrote: On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin wrote: > On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wr

Operator implicit conversion difference

2015-11-05 Thread ixid via Digitalmars-d-learn
This may have been overlooked in my other thread so I wanted to ask again: This seems very inconsistent, does a += b not lower to a = a + b? I guess not based on the below: ushort a = ushort.max, b = ushort.max; a += b; // Compiles fine a = a + b; // Error: cannot implicitly

Re: Preventing implicit conversion

2015-11-04 Thread ixid via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin wrote: On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote: Is there an elegant way of avoiding implicit conversion to int when you're using shorter types? Only with library solution. Implicit conversions are built into

Re: Preventing implicit conversion

2015-11-04 Thread ixid via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote: Is there an elegant way of avoiding implicit conversion to int when you're using shorter types? Also does this not seem inconsistent: ushort a = ushort.max, b = ushort.max; a += b; // Compiles fine a = a + b; // Error:

Preventing implicit conversion

2015-11-04 Thread ixid via Digitalmars-d-learn
Is there an elegant way of avoiding implicit conversion to int when you're using shorter types?

  1   2   >