Re: [your code here] 99 bottles of beer

2018-10-15 Thread SrMordred via Digitalmars-d
import std.format; template Bootle(alias Beer = 0) { static if(Beer < 99) enum Bootle = Bootle!(Beer + 1); else enum Bootle = Beer; pragma(msg, format!"%d bottles of beer on the wall, %d bottles of beer. Take one down, pass it around, %d bottles of beer on the wall."

DConf 2018 Videos

2018-05-21 Thread SrMordred via Digitalmars-d
There is some place where I can find this year conference videos with or without slides? Thanks!

Re: DConf 2018 Videos

2018-05-21 Thread SrMordred via Digitalmars-d
We're working to get each talk into separate videos, but it may take a while. Thank you very much! (for some odd reason the day 2 and 3 didn´t appear to me on youtube when I searched)

Re: betterC error?

2018-06-12 Thread SrMordred via Digitalmars-d
On Tuesday, 12 June 2018 at 12:29:17 UTC, rikki cattermole wrote: (...) this line: byte[] data = [0, 1]; is an dynamic array allocated with GC. But if you declare as a static array like byte[2] data = [0, 1]; than its not GC allocated.

Re: betterC error?

2018-06-12 Thread SrMordred via Digitalmars-d
Or use C malloc. We really should provide better tools to create arrays using C malloc (for those who want them). Like a betterC toolkit. -Steve Indeed, i´m creating my own "toolkit" for betterC stuff like alloc!Type(length); (much safer than malloc!) and other utilities :)

Re: A Case for Oxidation: A potential missed opportunity for D

2018-06-29 Thread SrMordred via Digitalmars-d
and non-template-only Phobos. unless they are using betterC (undefined reference to '_d_arraycopy')? Are you sure about this? //flags: -betterC -noboundscheck extern(C): void main() { import core.stdc.stdlib; int[] x = ( cast(int*) malloc( int.sizeof * 10 ) )[0 .. 10]; int[] y =

std.traits : Select - could it be better?

2018-07-05 Thread SrMordred via Digitalmars-d
alias U = Select!( isPointer!T, PointerTarget!T, T ); This don´t compile if T are not a pointer; so you have to do this: static if( isPointer!T ) alias U = PointerTarget!T; else alias U = T; Shouldnt the 'correct' way of Select to work is ignoring the choice that was not taken? I lo

Re: std.traits : Select - could it be better?

2018-07-05 Thread SrMordred via Digitalmars-d
On Thursday, 5 July 2018 at 20:29:02 UTC, Steven Schveighoffer wrote: On 7/5/18 4:27 PM, Steven Schveighoffer wrote: template BetterSelect(bool cond, alias temp1, alias temp2, Args...) {    import std.meta : Instantiate;    static if(cond)   alias BetterSelect = Instantiate!(temp1, Args)

Re: Struct destructors not available in -betterC?

2018-07-10 Thread SrMordred via Digitalmars-d
On Tuesday, 10 July 2018 at 19:14:26 UTC, Gary Willoughby wrote: Looking at the page on -betterC it says that struct destructors are not available. See point 11: https://dlang.org/spec/betterc.html#consequences This doesn't seem to be true as I'm using them with no problem. Yep, the docs are

Re: This is why I don't use D.

2018-09-04 Thread SrMordred via Digitalmars-d
On Wednesday, 5 September 2018 at 01:58:50 UTC, Jonathan M Davis wrote: On Tuesday, September 4, 2018 7:18:17 PM MDT James Blachly via Digitalmars-d wrote: [...] This is part of why it's sometimes been discussed that we need a way to indicate which dub packages are currently maintained and w

Messing with betterC and string type.

2018-09-06 Thread SrMordred via Digitalmars-d
I'm most of the time exploring the betterC lands and was thinking about custom strings, and how to convert D into D-betterC hmm I wonder... struct String{} alias string = String; string x = "test"; //cannot implicitly convert expression "test" of type string to String ok then... struct S

Re: Messing with betterC and string type.

2018-09-06 Thread SrMordred via Digitalmars-d
On Thursday, 6 September 2018 at 16:50:01 UTC, Adam D. Ruppe wrote: this(object.string x) {} Yep, this works. which will work - immutable(char)[] is what object.string actually is (and the compiler will often use that - immutable(char)[], the proper name - and string, the user-friendly name,

Re: Messing with betterC and string type.

2018-09-07 Thread SrMordred via Digitalmars-d
On Friday, 7 September 2018 at 08:26:11 UTC, Kagamin wrote: On Thursday, 6 September 2018 at 17:09:34 UTC, SrMordred wrote: void foo(string s) {} foo("this"); won't compile, since it won't make a String out of that immutable(char)[] literal without an explicit initialization of some sort.

Re: Messing with betterC and string type.

2018-09-07 Thread SrMordred via Digitalmars-d
On Friday, 7 September 2018 at 16:20:29 UTC, H. S. Teoh wrote: Yeah, I don't remember that either! Was this a recent addition? Or is it an accidental feature (aka bug)? :-P If it is a bug, please keep it ;)

Re: A Friendly Challenge for D

2018-10-10 Thread SrMordred via Digitalmars-d
On Wednesday, 10 October 2018 at 16:15:56 UTC, Jabari Zakiya wrote: [...] Looking forward to this :)

Re: C++17 Init statement for if/switch

2017-08-16 Thread SrMordred via Digitalmars-d
On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote: On Tuesday, 15 August 2017 at 20:31:50 UTC, Jonathan Marler wrote: Without alot of usage, it will just be an esoteric construct that looks confusing to the average developer. That is correct. After a while it gets tiring to see a

Re: C++17 Init statement for if/switch

2017-08-17 Thread SrMordred via Digitalmars-d
On Thursday, 17 August 2017 at 13:11:51 UTC, Enamex wrote: On Wednesday, 16 August 2017 at 14:19:59 UTC, SrMordred wrote: On Tuesday, 15 August 2017 at 21:05:09 UTC, bachmeier wrote: [...] There are two thinks of c++ that I miss a little on D: - Structured binding - Uniform initialization Bu

Just playing with compiler explorer to see assembly line count.

2017-10-03 Thread SrMordred via Digitalmars-d
//D compiled with gdc 5.2 -O3 auto test(int[] arr, int cmp) { int[] r; foreach(v ; arr) if(v == cmp)r~=v; return r; } // 51 lines of assembly auto test(int[] arr, int cmp) { return arr.filter!((v)=>v==cmp).array; } //1450 lines... what? Ok let me look also at c++: //gcc 7.

Re: Just playing with compiler explorer to see assembly line count.

2017-10-03 Thread SrMordred via Digitalmars-d
On Tuesday, 3 October 2017 at 13:53:38 UTC, rikki cattermole wrote: Be warned, x86 cpu's today are not like they were 10 years ago. A good portion of a symbol could be full of nop's and it could end up being faster than the one without them. Next, compare against ldc, not gdc primarily. Its be

Re: Just playing with compiler explorer to see assembly line count.

2017-10-03 Thread SrMordred via Digitalmars-d
On Tuesday, 3 October 2017 at 17:15:04 UTC, Daniel Kozak wrote: is not bad https://godbolt.org/g/bSfubs Thats cool, I never used copy xD. (but you returned the .copy range, not the 'r' array ;p) //now with ldc 1.4 and -O3 -release -boundscheck=off foreach -> 99 lines .filter.copy -> 3

Re: Proposal: Object/?? Destruction

2017-10-04 Thread SrMordred via Digitalmars-d
On Wednesday, 4 October 2017 at 10:03:56 UTC, aberba wrote: Upon reading this, It triggered an idea. On Saturday, 30 September 2017 at 16:10:44 UTC, Jonathan Marler wrote: [...] DIP reminds me of object destruction. /* extracts success & message from returned type. Could be tuple or stru

Re: D on quora ...

2017-10-06 Thread SrMordred via Digitalmars-d
On Friday, 6 October 2017 at 18:42:02 UTC, H. S. Teoh wrote: On Fri, Oct 06, 2017 at 06:09:58PM +, Ali via Digitalmars-d wrote: On Friday, 6 October 2017 at 17:27:03 UTC, H. S. Teoh wrote: > On Fri, Oct 06, 2017 at 05:14:51PM +, Rion via > Digitalmars-d wrote: > > https://www.quora.com

Re: D on quora ...

2017-10-07 Thread SrMordred via Digitalmars-d
I think the GC discussion think will never go away because of the amount of c++ coders that come here. If you want to flee from C++ you have two realistic options: Rust and D. When you are looking at D and comparing metaprogramming, traits, ranges, UFCS, etc, its amazing: 'SO MUCH better tha

Re: D on quora ...

2017-10-16 Thread SrMordred via Digitalmars-d
From https://wiki.dlang.org/Vision/2017H2: 2. @nogc: Use of D without a garbage collector, most likely by using reference counting and related methods Unique/Weak references) for reclamation of resources. This task is made challenging by the safety requirement. Eventually it will come (I hop

Re: What do people here use as an IDE?

2017-11-17 Thread SrMordred via Digitalmars-d
I keep jumping between VSCode and SublimeText3 atm using ST3. (but they are not IDEs ;P)

Re: Tuple DIP

2018-01-12 Thread SrMordred via Digitalmars-d
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote: As promised [1], I have started setting up a DIP to improve +1, please.

Re: struct constructors and destructors.

2017-07-19 Thread SrMordred via Digitalmars-d
On Wednesday, 19 July 2017 at 09:09:40 UTC, Stefan Koch wrote: On Wednesday, 19 July 2017 at 07:48:28 UTC, Danni Coy wrote: Is there a reason that the following code struct Foo { this (string name) { do_something(name); } ~this() { undo_something(); } } Foo foo = void; void o

Re: struct constructors and destructors.

2017-07-19 Thread SrMordred via Digitalmars-d
On Wednesday, 19 July 2017 at 14:09:32 UTC, SrMordred wrote: On Wednesday, 19 July 2017 at 09:09:40 UTC, Stefan Koch wrote: On Wednesday, 19 July 2017 at 07:48:28 UTC, Danni Coy wrote: Is there a reason that the following code struct Foo { this (string name) { do_something(name); }