Re: Documents about ddoc? and markdown in ddoc?

2018-10-17 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 18 October 2018 at 05:59:36 UTC, rikki cattermole wrote: On 18/10/2018 6:38 PM, dangbinghoo wrote: hi, Is there any other documents related about ddoc usage? the only thing I can find is:  https://dlang.org/spec/ddoc.html#using_ddoc_to_generate_examples But I found it never

Re: Documents about ddoc? and markdown in ddoc?

2018-10-17 Thread rikki cattermole via Digitalmars-d-learn
On 18/10/2018 6:38 PM, dangbinghoo wrote: hi, Is there any other documents related about ddoc usage? the only thing I can find is:  https://dlang.org/spec/ddoc.html#using_ddoc_to_generate_examples But I found it never mentioned something like $(LI a  list item), is there a full ddoc docume

Documents about ddoc? and markdown in ddoc?

2018-10-17 Thread dangbinghoo via Digitalmars-d-learn
hi, Is there any other documents related about ddoc usage? the only thing I can find is: https://dlang.org/spec/ddoc.html#using_ddoc_to_generate_examples But I found it never mentioned something like $(LI a list item), is there a full ddoc document available? And, is there any info about

Re: betterC generate dynamic array throw Error: TypeInfo cannot be used with -betterC

2018-10-17 Thread test via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 16:50:36 UTC, Paul Backus wrote: On Wednesday, 17 October 2018 at 07:01:21 UTC, test wrote: simple example: you can not use functionAttributes from betterC

Re: Access program args outside of main

2018-10-17 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 22:37:53 UTC, Stanislav Blinov wrote: On Wednesday, 17 October 2018 at 22:30:31 UTC, Jordan Wilson wrote: Ideally, I'd check args before I take the time to load up data. https://dlang.org/phobos/core_runtime.html#.Runtime Here I was looking through std...t

Re: betterC generate dynamic array throw Error: TypeInfo cannot be used with -betterC

2018-10-17 Thread learnfirst1 via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 16:50:36 UTC, Paul Backus wrote: You can't append to an array in betterC code, because making space for the new elements requires allocating memory, and that uses the GC. In theory, since you're only using the GC during CTFE, it shouldn't be a problem, but the

Re: lazy variables

2018-10-17 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 07:32:37 UTC, aliak wrote: lazy S x = () { // do some heavy stuff }(); if (condition) { func(x.y); // heavy stuff evaluated here } auto x = () { // do some heavy stuff }; if (condition) { func(x().y); // heavy stuff evaluated here } If you want

How do you get a .dub project to build / run / debug in Visual D?

2018-10-17 Thread Enjoys Math via Digitalmars-d-learn
I'm referring mainly to the `dagon` game engine. Doing: dub build :tutorial1 dub run :tutorial1 works on windows 10. I'm not sure how to replicate this build process with Visual Studio 2017 project settings. Dagon is building, but I'm getting errors with a basic Hellow World app in Dagon.

Re: Which Docker to use?

2018-10-17 Thread Jon Degenhardt via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 08:08:44 UTC, Gary Willoughby wrote: On Wednesday, 17 October 2018 at 03:37:21 UTC, Ky-Anh Huynh wrote: Hi, I need to build some static binaries with LDC. I also need to execute builds on both platform 32-bit and 64-bit. From Docker Hub there are two image g

Re: Do D's std.signals check for already-connected slot and simply ignore the call?

2018-10-17 Thread Enjoys Math via Digitalmars-d-learn
Answer: they don't connect uniquely, you have to manage that yourself.

Re: Access program args outside of main

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 22:30:31 UTC, Jordan Wilson wrote: Ideally, I'd check args before I take the time to load up data. https://dlang.org/phobos/core_runtime.html#.Runtime

Access program args outside of main

2018-10-17 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Is there a way to access command line arguments outside of main? // main.d module main; import data; void main(string args[]) { } // data.d module data immutable programData; static this() { // read in data } Ideally, I'd check args before I take the time to load up data. Thanks

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 20:53:02 UTC, Vijay Nayar wrote: This particular use of "scope" I overheard at the last DConf, and I believe it has been added to the official documentation here: https://dlang.org/spec/expression.html#new_expressions If a NewExpression is used as an init

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2018 01:53 PM, Vijay Nayar wrote: > https://dlang.org/spec/expression.html#new_expressions > > If a NewExpression is used as an initializer for a function local > variable with > scope storage class, and the ArgumentList to new is empty, then the > instance is > allocated

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Vijay Nayar via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 20:41:24 UTC, Ali Çehreli wrote: On 10/17/2018 01:24 PM, Vijay Nayar wrote: I have a snippet of code like this:     scope chordAngle = new S1ChordAngle(_center, other._center);     return _radius + other._radius >= chordAngle; The reason the "scope" temporar

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Vijay Nayar via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 20:51:29 UTC, Stanislav Blinov wrote: On Wednesday, 17 October 2018 at 20:24:56 UTC, Vijay Nayar wrote: I have a snippet of code like this: scope chordAngle = new S1ChordAngle(_center, other._center); return _radius + other._radius >= chordAngle; The r

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 20:24:56 UTC, Vijay Nayar wrote: I have a snippet of code like this: scope chordAngle = new S1ChordAngle(_center, other._center); return _radius + other._radius >= chordAngle; The reason the "scope" temporary variable exists is to avoid a heap allocation

Re: lazy variables

2018-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2018 12:32 AM, aliak wrote: Hi, Is there any notion of lazy vars in D (i see that there're parameters)? i.e: struct S {   //...   int y;   //... } lazy S x = () {     // do some heavy stuff }(); if (condition) {   func(x.y); // heavy stuff evaluated here } Cheers, - Ali

Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Vijay Nayar via Digitalmars-d-learn
I have a snippet of code like this: scope chordAngle = new S1ChordAngle(_center, other._center); return _radius + other._radius >= chordAngle; The reason the "scope" temporary variable exists is to avoid a heap allocation and instead prefer a value be created on the stack. Is there a w

Re: Can Scope Be Used for Anonymous Objects?

2018-10-17 Thread Ali Çehreli via Digitalmars-d-learn
On 10/17/2018 01:24 PM, Vijay Nayar wrote: I have a snippet of code like this:     scope chordAngle = new S1ChordAngle(_center, other._center);     return _radius + other._radius >= chordAngle; The reason the "scope" temporary variable exists is to avoid a heap allocation and instead prefer a

Re: custom sorting of lists ?

2018-10-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/17/18 2:03 PM, Carl Sturtivant wrote: On Monday, 15 October 2018 at 13:39:59 UTC, Steven Schveighoffer wrote: But that's just the thing -- merge sort *does* depend on the container type. It requires the ability to rearrange the elements structurally, since you merge the sets of items to

Re: custom sorting of lists ?

2018-10-17 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 15 October 2018 at 13:39:59 UTC, Steven Schveighoffer wrote: But that's just the thing -- merge sort *does* depend on the container type. It requires the ability to rearrange the elements structurally, since you merge the sets of items together. This requires making another list fr

Re: betterC generate dynamic array throw Error: TypeInfo cannot be used with -betterC

2018-10-17 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 07:01:21 UTC, test wrote: test1: module test1; import test2; enum X = getR(1,3); void main(string[] args){} test2: module test2; struct R { int i; } R[] getR(int a, int b){ R[] r; r ~= R(a);

Re: Dealing with ranges where front and popFront do the same logic / eager ranges

2018-10-17 Thread Dennis via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 00:12:13 UTC, H. S. Teoh wrote: I'm not sure what's the reasoning behind the saying that throwing exceptions in ctors is bad, but exceptions are exactly the kind of thing designed for handling this sort of situation. If the parser detects a problem early (i.e.,

Re: why is the default floating point value NAN ?

2018-10-17 Thread Dennis via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 15:51:21 UTC, Codifies wrote: okay I should have carried on reading the blog, its so uninitialized values stick out when debugging... Indeed, the initial value is not supposed to be useful, it's there because dealing with garbage memory when forgetting to init

Re: why is the default floating point value NAN ?

2018-10-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 15:48:16 UTC, Codifies wrote: I'd have thought it ought to be 0.0 ? So far I seen carefully considered and sensible reasons for doing things in D, so why NAN ? You are supposed to initialize your own variables explicitly. NaN is a somewhat easy way to indicat

Re: why is the default floating point value NAN ?

2018-10-17 Thread Codifies via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 15:48:16 UTC, Codifies wrote: I'd have thought it ought to be 0.0 ? So far I seen carefully considered and sensible reasons for doing things in D, so why NAN ? okay I should have carried on reading the blog, its so uninitialized values stick out when debuggin

why is the default floating point value NAN ?

2018-10-17 Thread Codifies via Digitalmars-d-learn
I'd have thought it ought to be 0.0 ? So far I seen carefully considered and sensible reasons for doing things in D, so why NAN ?

Re: Who can stop it ? Help me,thank you.

2018-10-17 Thread Tony via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 14:06:49 UTC, FrankLike wrote: Where can get the new dmd or ldc2 that's no 'Trojan horse virus' ? https://dlang.org/download.html

Re: Who can stop it ? Help me,thank you.

2018-10-17 Thread FrankLike via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 13:50:03 UTC, Stanislav Blinov wrote: On Wednesday, 17 October 2018 at 13:48:04 UTC, FrankLike wrote: What can I do? Delete the bloatware that you downloaded. Where can get the new dmd or ldc2 that's no 'Trojan horse virus' ?

Re: Who can stop it ? Help me,thank you.

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 13:48:04 UTC, FrankLike wrote: What can I do? Delete the bloatware that you downloaded.

Who can stop it ? Help me,thank you.

2018-10-17 Thread FrankLike via Digitalmars-d-learn
Hi,teacher: I like D lang,when I download the soft from http://www.360totalsecurity.com/en/, but I find, the link.exe of dmd or ldc2,all have the ‘Trojan horse virus’. dmd.2.082.1.windows.7z:HEUR/QVM19.1.92C9.Malware.Gen file MD5:91ce2a59f06151902a1f3fc49e0a4752 ldc2-7e9db717-window

Re: Dealing with ranges where front and popFront do the same logic / eager ranges

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 09:53:22 UTC, Dukc wrote: Whatever iterates through the range could then throw an appopriate exception when it encounters an error token. Exceptions in a parser? Monsieur knows his perversion.

Re: Dealing with ranges where front and popFront do the same logic / eager ranges

2018-10-17 Thread Dukc via Digitalmars-d-learn
On Tuesday, 16 October 2018 at 22:59:50 UTC, Dennis wrote: [snip] The first thing to consider for invalid tokens, at least for me, would be to either have popFront set empty to true, or set front to some value representing a parsing error. A programming language parser almost certainly needs

Re: lazy variables

2018-10-17 Thread Chris Katko via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 07:32:37 UTC, aliak wrote: Hi, Is there any notion of lazy vars in D (i see that there're parameters)? i.e: struct S { //... int y; //... } lazy S x = () { // do some heavy stuff }(); if (condition) { func(x.y); // heavy stuff evaluated here }

Re: Which Docker to use?

2018-10-17 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 03:37:21 UTC, Ky-Anh Huynh wrote: Hi, I need to build some static binaries with LDC. I also need to execute builds on both platform 32-bit and 64-bit. From Docker Hub there are two image groups: * language/ldc (last update 5 months ago) * dlang2/ldc-ubuntu (

lazy variables

2018-10-17 Thread aliak via Digitalmars-d-learn
Hi, Is there any notion of lazy vars in D (i see that there're parameters)? i.e: struct S { //... int y; //... } lazy S x = () { // do some heavy stuff }(); if (condition) { func(x.y); // heavy stuff evaluated here } Cheers, - Ali

Re: how to get UDA only for methods

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 02:54:26 UTC, test wrote: I need get the Route UDA only for method without (static methods, property, constructor, destructor), dont know how to do it. 1) Note that __traits(allMembers, T) gets you a tuple of names, not actual member aliases. 2) Remember ther

betterC generate dynamic array throw Error: TypeInfo cannot be used with -betterC

2018-10-17 Thread test via Digitalmars-d-learn
test1: module test1; import test2; enum X = getR(1,3); void main(string[] args){} test2: module test2; struct R { int i; } R[] getR(int a, int b){ R[] r; r ~= R(a); r ~= R(b); return r; } to build wi

Re: betterC generate dynamic array throw Error: TypeInfo cannot be used with -betterC

2018-10-17 Thread test via Digitalmars-d-learn
On Wednesday, 17 October 2018 at 07:01:21 UTC, test wrote: test2.d(3): Error: TypeInfo cannot be used with -betterC the first problem is the error message is not clear and can be improved. And my question is how to workaround this to make it work with betterC.