What is pure used for?

2021-11-24 Thread sclytrack via Digitalmars-d-learn
My understanding is that pure is used for compiler optimization in loops and expressions. It leaves out multiple calls if it figures out it is not needed. Is pure used for anything else? int * pureFunction() 1) the pointer needs to be the same. 2) the value that the pointer points to needs

Reference Counted Class

2021-07-14 Thread sclytrack via Digitalmars-d-learn
Would reference counted classes by default be too much of a change? Is it a bad idea? Currently there a changes in the language where you can avoid the reference count, right? Combination both the rc and the stop-the-world gc, for the cycles.

Re: dip1000 rule 5

2018-11-27 Thread sclytrack via Digitalmars-d-learn
On Monday, 26 November 2018 at 09:10:23 UTC, sclytrack wrote: On Sunday, 25 November 2018 at 19:22:36 UTC, sclytrack wrote: There are 4 rules listed. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md What is rule 5? int* global_ptr; void abc() { scope int* a; int* b;

Re: dip1000 rule 5

2018-11-26 Thread sclytrack via Digitalmars-d-learn
On Sunday, 25 November 2018 at 19:22:36 UTC, sclytrack wrote: There are 4 rules listed. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md What is rule 5? int* global_ptr; void abc() { scope int* a; int* b; scope int* c = a; // Error, rule 5 scope int* d = b;

Re: dip1000 rule 5

2018-11-25 Thread sclytrack via Digitalmars-d-learn
On Sunday, 25 November 2018 at 19:49:03 UTC, Stanislav Blinov wrote: On Sunday, 25 November 2018 at 19:22:36 UTC, sclytrack wrote: There are 4 rules listed. ... What is rule 5? ... Wouldn't you call it D3 because of the name mangling of DIP1000 once activated by default? That "rule 5" looks

dip1000 rule 5

2018-11-25 Thread sclytrack via Digitalmars-d-learn
There are 4 rules listed. https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md What is rule 5? int* global_ptr; void abc() { scope int* a; int* b; scope int* c = a; // Error, rule 5 scope int* d = b; // Ok int* i = a;// Ok, scope is inferred

multiqualifier

2018-06-16 Thread sclytrack via Digitalmars-d-learn
I'm going to post this in learn in order not to disturb "the guys". Multiqualifiers --- Warning: Stop reading if you don't have time. Tail-const rant in disguise. (1) Going from immutable to mutable, one layer deep. --- In the D programming

Re: What wrong?

2015-05-14 Thread sclytrack via Digitalmars-d-learn
On Tuesday, 5 May 2015 at 07:41:04 UTC, sclytrack wrote: On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote: On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote: On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote: I see it by the lack of 42. :) But why is this

Re: What wrong?

2015-05-05 Thread sclytrack via Digitalmars-d-learn
On Monday, 4 May 2015 at 01:03:43 UTC, Fyodor Ustinov wrote: On Saturday, 2 May 2015 at 20:46:32 UTC, Dennis Ritchie wrote: On Saturday, 2 May 2015 at 19:38:01 UTC, Fyodor Ustinov wrote: I see it by the lack of 42. :) But why is this receive breaks down? import std.stdio; import

o!(const(T)) parameter.

2015-04-25 Thread sclytrack via Digitalmars-d-learn
I want a function with parameter o!(const(Form)) to accept both o!(Form) and o!(immutable(Form)) Is there a way to do it? import std.stdio; import std.traits; class Form { int number = 10; } struct o(T) { T data; this(T data) { this.data =

Re: o!(const(T)) parameter.

2015-04-25 Thread sclytrack via Digitalmars-d-learn
It works when you exclude the recursive alias this: static if(!is(T == const)) alias constify this; Your original program crashes the compiler, which is always a bug. I filed an issue: https://issues.dlang.org/show_bug.cgi?id=14499 Thank you, very much.

Re: using exceptions in @nogc

2015-03-31 Thread sclytrack via Digitalmars-d-learn
On Tuesday, 31 March 2015 at 01:40:54 UTC, weaselcat wrote: was this ever solved? I did some research and saw static immutable ones suggested a few times, but they can't be chained AFAIK. Reference counted exceptions. Not solved.

Re: is eC alot like D?

2015-03-11 Thread sclytrack via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 04:10:51 UTC, Taylor Hillegeist wrote: On Wednesday, 11 March 2015 at 03:55:21 UTC, Rikki Cattermole wrote: On 11/03/2015 4:16 p.m., Taylor Hillegeist wrote: So I found http://ec-lang.org/ it seems alot like D, But it has a company backing it. It just seems

Re: DList.Range magically becomes empty.

2015-02-25 Thread sclytrack via Digitalmars-d-learn
On Wednesday, 25 February 2015 at 09:07:17 UTC, Tobias Pankrath wrote: import std.container; import std.stdio; void main() { DList!int list; Array!(DList!int.Range) stack; foreach(i; 0 .. 4) { list.stableInsertBack(i); stack.insertBack(list[]); } writefln(list:

monodevelop mono-d versions

2014-08-01 Thread sclytrack via Digitalmars-d-learn
I can't seem to install mono-d. It always seems to want a newer version of MonoDevelop. I'm on Ubuntu 14.04 LTS and it has version 4.0.12 of MonoDevelop. Has anybody else got this to work with this version? I have this file called MonoDevelop.D-1.9.6.mpack Tools-Add In Manager-Install

Re: std.file.read returns void[] why?

2014-04-17 Thread sclytrack via Digitalmars-d-learn
On Thursday, 17 April 2014 at 14:05:50 UTC, Regan Heath wrote: On Thu, 17 Apr 2014 13:59:20 +0100, Steven Schveighoffer schvei...@yahoo.com wrote: It was never possible. You must explicitly cast to void[]. to - from? void[] makes actually little sense as the result of whole-file read that

Re: std.file.read returns void[] why?

2014-04-17 Thread sclytrack via Digitalmars-d-learn
Are you saying void[] *is* currently marked NOSCAN? import std.stdio; import core.memory; writeln(int* [], GC.query(cast(void *) arr2).attr);