D Language Foundation January 2023 Quarterly Meeting Summary
ryuukk_
ryuukk.dev at gmail.com
Mon Feb 27 14:21:04 UTC 2023
I use -betterC because i can focus on the language and build upon
it, i don't have to deal with the slowness of phobos and more
importantly, i don't have to wait for phobos or druntime to be
ported to WASM in order to be able to target to WASM, i target
WASM today
It also makes me confident that none of my game code will
accidentally call the GC, as i banned the use of the GC for this
particular project (game)
I can focus on what i love about C with the greatness of D (the
language)
My project fully recompile (clean build, game+engine) in just
1.2s, thanks Walter!
The only complain i have about betterC, and D in general are the
error messages, sometimes just having new lines with proper
spacing makes errors easier to read, i made a comment in one
PR(related to improving betterC error message) that it was
helpful and very much welcome, so looks like things are going to
improve
> Walter decided to put the Sum Types proposal aside for now
That's super sad to hear.. i was eagerly hoping tagged union
would come sooner rather than later.. it's one feature that
enables writing useful with less noise
I want to replace that kind of ugly code that i have, notice how
easy it is to have bugs if you are not careful what field you
use, not safe!: (no, template is not the solution)
```D
enum EventType: ubyte
{
QUIT,
GFX_RESIZE,
INPUT_KEY_DOWN,
INPUT_KEY_UP,
INPUT_KEY_TYPED,
INPUT_TOUCH_DOWN,
INPUT_TOUCH_UP,
INPUT_TOUCH_DRAGGED,
INPUT_MOUSE_MOVED,
INPUT_SCROLLED,
}
struct Event
{
long time;
bool consumed;
EventType type;
union
{
// GFX
Resize resize;
// INPUT
KeyDown key_down;
KeyUp key_up;
KeyTyped key_typed;
TouchDown touch_down;
TouchUp touch_up;
TouchDragged touch_dragged;
TouchMoved touch_moved;
Scrolled scrolled;
}
}
(..)
// update key state
foreach(Event* e; engine.queue)
{
if (e.consumed) continue;
switch (e.type) with (EventType)
{
case INPUT_KEY_DOWN:
switch(e.key_down.key)
{
(..)
}
break;
case INPUT_KEY_UP:
switch(e.key_up.key)
{
(..)
}
break;
case INPUT_TOUCH_DOWN:
if (e.touch_down.button == 1)
(..)
break;
case INPUT_TOUCH_UP:
if (e.touch_up.button == 1)
(..)
break;
default:break;
}
}
```
I think expecting users to ask for new features shouldn't be seen
as something bad
It's great to have people discuss language improvement, it gives
the ability to talk about and remind people about existing
features, and potentially their issues
And what a better opportunity than to remind ones who think bugs
in weird and cryptic corner cases, is what turn off people
What turn me off from D is that kind of issues:
https://github.com/dlang/dub/issues/2600
When you start to import things from the std and it makes your
compile time go from 5seconds (already an eternity) to 10
seconds, and people think "it's not a problem"
tagged union would help reduce the code complexity, template
usage and bugs by a significant amount of time, as well as
improving error messages
https://forum.dlang.org/thread/zsxipgibubqgnwwwxhqx@forum.dlang.org
More information about the Digitalmars-d-announce
mailing list