Re: Possible to overload assignment of struct field ??

2021-08-23 Thread Ali Çehreli via Digitalmars-d-learn
On 8/23/21 10:25 PM, james.p.leblanc wrote: So, you need a "property". Easy... :) 1) Rename the member e.g. as a_. 2) Write setter and getter functions named 'a'. struct Foo{ int a_; int a() const { return a_; } void a(int value) { a_ = value; } } void main(){ auto x =

Possible to overload assignment of struct field ??

2021-08-23 Thread james.p.leblanc via Digitalmars-d-learn
Greetings, With a struct, there are many overload possibilities available. However, I haven't been able to find how to overload assignment of **selected fields** of a struct. For example, suppose: struct Foo{ int a; int b; ... } void main(){ auto x =

Re: compile time compression for associatve array literal

2021-08-23 Thread Brian Tiffin via Digitalmars-d-learn
On Monday, 23 August 2021 at 14:49:17 UTC, jfondren wrote: On Monday, 23 August 2021 at 14:04:05 UTC, Brian Tiffin wrote: That's the goal. It's an optional goal at this point. I'm not *really* worried about size of object code, yet, but figured this would be a neat way to shrink the compiled

Emacs AutoComplete Tutorial Video for D Language

2021-08-23 Thread Mahdi via Digitalmars-d-learn
I made this video for people asking how to configure Dlang in Emacs environment:) : https://peertube.linuxrocks.online/w/62pWpmw2r4Se1XvmYiWm75

Re: Vibe.d error

2021-08-23 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 20 August 2021 at 17:39:29 UTC, JG wrote: On Friday, 20 August 2021 at 10:50:12 UTC, WebFreak001 wrote: On Wednesday, 18 August 2021 at 19:51:00 UTC, JG wrote: [...] There might be incompatibilities with how openssl is used and the installed openssl version or config. If you

Re: compile time compression for associatve array literal

2021-08-23 Thread jfondren via Digitalmars-d-learn
On Monday, 23 August 2021 at 14:04:05 UTC, Brian Tiffin wrote: That's the goal. It's an optional goal at this point. I'm not *really* worried about size of object code, yet, but figured this would be a neat way to shrink the compiled code generated from some large COBOL source fragments

Re: compile time compression for associatve array literal

2021-08-23 Thread Brian Tiffin via Digitalmars-d-learn
On Monday, 23 August 2021 at 11:53:46 UTC, ag0aep6g wrote: On 23.08.21 08:14, Brian Tiffin wrote: From ~~a~~ little reading, it seems associative array literal initialization is still pending for global scope, but allowed in a module constructor?  *If I understood the skimming surface

Re: Unexpected result comparing to null

2021-08-23 Thread jfondren via Digitalmars-d-learn
On Monday, 23 August 2021 at 13:00:36 UTC, DLearner wrote: Hi The code below compiles and runs producing 'Not null'. ``` void main() { import std.stdio; int Var1; int* ptrVar; ptrVar = if (ptrVar == null) { writeln("Null"); } else { writeln("Not null");

Unexpected result comparing to null

2021-08-23 Thread DLearner via Digitalmars-d-learn
Hi The code below compiles and runs producing 'Not null'. ``` void main() { import std.stdio; int Var1; int* ptrVar; ptrVar = if (ptrVar == null) { writeln("Null"); } else { writeln("Not null"); } } ``` However, should it not fail to compile, as '=='

Re: compile time compression for associatve array literal

2021-08-23 Thread ag0aep6g via Digitalmars-d-learn
On 23.08.21 08:14, Brian Tiffin wrote: From ~~a~~ little reading, it seems associative array literal initialization is still pending for global scope, but allowed in a module constructor?  *If I understood the skimming surface reading so far*. ```d immutable string[string] things; static

Re: How to get element type of a slice?

2021-08-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Saturday, 21 August 2021 at 02:59:39 UTC, Jesse Phillips wrote: On Thursday, 19 August 2021 at 04:03:31 UTC, jfondren wrote: On Thursday, 19 August 2021 at 03:32:47 UTC, Jesse Phillips wrote: On Tuesday, 17 August 2021 at 12:33:03 UTC, Ferhat Kurtulmuş wrote: Hey, thank you again but, I

compile time compression for associatve array literal

2021-08-23 Thread Brian Tiffin via Digitalmars-d-learn
From ~~a~~ little reading, it seems associative array literal initialization is still pending for global scope, but allowed in a module constructor? *If I understood the skimming surface reading so far*. ```d immutable string[string] things; static (this) { things = ["key1": "value 1",