On Sunday, 17 October 2021 at 02:42:54 UTC, Tejas wrote:
Doesn't solve the compile-time only problem though :(
The only solution I can think of is something with `variant`s,
but it'll be messy.
Well, the fundamental issue is that in a language like D that
compiles to machine code, variable n
On Sunday, 17 October 2021 at 02:31:04 UTC, Paul Backus wrote:
On Saturday, 16 October 2021 at 23:07:22 UTC, DLearner wrote:
```d
void main() {
import std.stdio;
int fooVar = 4;
string strVar;
strVar = "fooVar";
writeln(typeof(mixin(strVar)));
writeln(mixin(strVar));
}
```
On Saturday, 16 October 2021 at 23:07:22 UTC, DLearner wrote:
```d
void main() {
import std.stdio;
int fooVar = 4;
string strVar;
strVar = "fooVar";
writeln(typeof(mixin(strVar)));
writeln(mixin(strVar));
}
```
Failed with 2x "Error: variable `strVar` cannot be read at
comp
On Saturday, 16 October 2021 at 23:07:22 UTC, DLearner wrote:
On Saturday, 16 October 2021 at 19:29:59 UTC, Dennis wrote:
On Saturday, 16 October 2021 at 19:28:04 UTC, DLearner wrote:
How does one obtain from strVar:
1. The type of fooVar;
`typeof(mixin(strVar))`
2. The value of fooVar?
`
On Saturday, 16 October 2021 at 19:29:59 UTC, Dennis wrote:
On Saturday, 16 October 2021 at 19:28:04 UTC, DLearner wrote:
How does one obtain from strVar:
1. The type of fooVar;
`typeof(mixin(strVar))`
2. The value of fooVar?
`mixin(strVar)`
```
void main() {
import std.stdio;
int
On Saturday, 16 October 2021 at 19:28:04 UTC, DLearner wrote:
How does one obtain from strVar:
1. The type of fooVar;
`typeof(mixin(strVar))`
2. The value of fooVar?
`mixin(strVar)`
Hi
Suppose string variable strVar has value "fooVar".
fooVar is a valid variable name used elsewhere in the program.
How does one obtain from strVar:
1. The type of fooVar;
2. The value of fooVar?
Best regards