On Sunday, 1 September 2024 at 03:06:53 UTC, Paul Backus wrote:
> On Saturday, 31 August 2024 at 22:06:26 UTC, kdevel wrote:
> Is that functionally different from
void main()
{
import std.stdio;
int[string] test = ["hello": 42];
if (auto p = "hello" in test)
{
writeln("hello => ", *p);
}
}
It's essentially the same. I only suggested it because the original question was about alternatives to pointers, and Nullable
isn't a pointer.
you are wrong, the question wasn't about "an alternative to pointer"
i'll quote myself:
> Is there a way to get the value instead of a pointer? while keeping the conciseness (one line)
this is not asking for an "alternative"
if i have to call .get
or dereference the pointer myself, the premise of "conciseness and one liner" is lost
i pasted a simple example so everyone understands the task, my actual use case is more complex and longer
> I suppose it goes to show that avoiding language features just for the sake of it ("no pointers", "no templates", "no imports", ...) is unlikely to accomplish anything useful. :)
you didn't understand the question, so why assume this?
if checking for/getting a value from a hashmap requires all that crap, then perhaps something is wrong with the language, and it perhaps isn't the one i should have picked for the task
my mistake perhaps, not yours
besides, i do use the language features in my project, templates and mixins to solve larger problems, it's great, and reason why i picked D
another thing people don't understand:
$ time make build-game
real 0m0.402s
user 0m0.352s
sys 0m0.050s
i value this too, more than anything else, and i like good error messages
i don't like cryptic error messages and 10+ seconds build times
i won't bother reading this thread, as i said, i lost interest, if you can't understand what an improvement is from a user PoV, then there is nothing else for me to say