Re: Where is pragma Declaration in the grammar?

2020-12-04 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 5 December 2020 at 03:55:52 UTC, Stefan Koch wrote: On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote: They're under Attribute: https://dlang.org/spec/grammar.html#Attribute The syntax tree for `pragma(msg, typeof(f))` in a declaration context would be: DeclDef

Re: Where is pragma Declaration in the grammar?

2020-12-04 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote: On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote: Hi, today I've been dusting my SDC fork and implemented a rudimentary version of pragma(msg). I could pragmaStatement as in void f() { pragma(msg,

Re: Where is pragma Declaration in the grammar?

2020-12-04 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote: Hi, today I've been dusting my SDC fork and implemented a rudimentary version of pragma(msg). I could pragmaStatement as in void f() { pragma(msg, typeof(f)); } but not a declaration as in pragma(msg, typeof(f)) without a

Where is pragma Declaration in the grammar?

2020-12-04 Thread Stefan Koch via Digitalmars-d-learn
Hi, today I've been dusting my SDC fork and implemented a rudimentary version of pragma(msg). I could pragmaStatement as in void f() { pragma(msg, typeof(f)); } but not a declaration as in pragma(msg, typeof(f)) without a function body. there is a StaticAssert is in the grammar under

Re: Pass enum variable as const ref arg

2020-12-04 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 4 December 2020 at 12:54:25 UTC, Andrey wrote: Hello, void test(const ref string[3] qazzz) { qazzz.writeln; } void main() { enum string[3] value = ["qwer", "ggg", "v"]; test(value); } Gives errors: It works if you pass `-preview=rvaluerefparam` to the compiler. But the

Re: Pass enum variable as const ref arg

2020-12-04 Thread Andrey via Digitalmars-d-learn
Thank you!

Re: Pass enum variable as const ref arg

2020-12-04 Thread Paul Backus via Digitalmars-d-learn
On Friday, 4 December 2020 at 13:42:45 UTC, Andrey wrote: Hm, you mean that enum variable is not a real variable? I thought that to make CT variable you should mark it as enum (in c++ as constexpr). How to do it here? The official name for what you're calling an "enum variable" is "manifest

Re: Pass enum variable as const ref arg

2020-12-04 Thread rikki cattermole via Digitalmars-d-learn
On 05/12/2020 2:42 AM, Andrey wrote: Hm, you mean that enum variable is not a real variable? It is not a variable. It is a constant that cannot be changed and does not exist in the executable. I thought that to make CT variable you should mark it as enum (in c++ as constexpr). How to do

Re: Pass enum variable as const ref arg

2020-12-04 Thread Andrey via Digitalmars-d-learn
Hm, you mean that enum variable is not a real variable? I thought that to make CT variable you should mark it as enum (in c++ as constexpr). How to do it here?

Re: Pass enum variable as const ref arg

2020-12-04 Thread rikki cattermole via Digitalmars-d-learn
On 05/12/2020 1:54 AM, Andrey wrote: Hello, void test(const ref string[3] qazzz) { qazzz.writeln; } void main() {     enum string[3] value = ["qwer", "ggg", "v"]; That is a compile time constant (remove the enum).     test(value); } Gives errors: onlineapp.d(26): Error: function

Pass enum variable as const ref arg

2020-12-04 Thread Andrey via Digitalmars-d-learn
Hello, void test(const ref string[3] qazzz) { qazzz.writeln; } void main() { enum string[3] value = ["qwer", "ggg", "v"]; test(value); } Gives errors: onlineapp.d(26): Error: function onlineapp.test(ref const(string[3]) qazzz) is not callable using argument types (string[3])

Re: strip in stdin

2020-12-04 Thread Paul Backus via Digitalmars-d-learn
On Friday, 4 December 2020 at 06:51:32 UTC, MGW wrote: string[] m = stdin.byLineCopy.array; How to make strip() for each line in an expression ... To apply a function to each element of a range, use the `map` algorithm: import std.algorithm: map; string[] m =

Re: Anybody know if I can build DMD with Visual Studio 2019?

2020-12-04 Thread Q. Schroll via Digitalmars-d-learn
On Friday, 4 December 2020 at 09:32:29 UTC, Imperatorn wrote: On Wednesday, 2 December 2020 at 22:37:06 UTC, WhatMeWorry wrote: It works now. Not sure what I did to _not_ make it work yesterday. That's easy. You made a post here about it and the universe got scared. This made my day.

Re: Anybody know if I can build DMD with Visual Studio 2019?

2020-12-04 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 2 December 2020 at 22:37:06 UTC, WhatMeWorry wrote: On Tuesday, 1 December 2020 at 22:58:53 UTC, WhatMeWorry wrote: I'm trying to build DMD with Visual D under Visual Studio as shown in the Wiki: https://wiki.dlang.org/Building_under_Windows The notes say to use the solution

Re: My first application in Dlang

2020-12-04 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 3 December 2020 at 03:54:16 UTC, Marcone wrote: On Thursday, 3 December 2020 at 02:44:40 UTC, Ali Çehreli wrote: On 12/2/20 5:46 PM, Marcone wrote: [...] Cool. :) But did you want to share your *source* code? All I see there is a .exe, which I would not start due to risk of