ratchet freak

Sep 10, 2024 09:03
it's easy when your code mentality already aligns with rust, it's a massive pain when it doesn't and you get forced into another paradigm
Sep 3, 2024 11:10
every C like with obligatory semicolons suffers the same problem
Sep 3, 2024 11:10
@TheEmptyStringPhotographer that's more about how bad the grammar is and how difficult it is to parse in that common failure mode
Jul 16, 2024 16:21
if you then hit another overload you do the same each stack state is matched against every function in the overload set
Jul 16, 2024 16:20
then the stack state after g is duplicated for each function in the overload set
Jul 16, 2024 16:18
if you match against a wildcard you keep all function in the overload set
Jul 16, 2024 16:18
for that you can do the same but with a wildcard stack
Jul 16, 2024 16:03
if you have multiple overloads then the program is ambiguous and you'll need to decide how to handle that
Jul 16, 2024 16:03
if any function in the set runs out of arguments it's a possible overload
Jul 16, 2024 16:03
depends on what exact semantics you want for overloads, but it might be

when you see an overloaded function check the top of the stack against the first argument of all functions in the overload set. filter out any that don't have a valid implicit conversion.

Then check the next argument etc.
Jul 16, 2024 15:40
type inference happens when you infer a type based on other information rather than and explicit declarations,

so the first step is to propagate the known type information until you need to do an inference
Jul 16, 2024 15:37
then infer
Jul 16, 2024 15:37
you need to know the type at the inference point
Jul 16, 2024 15:37
wouldn't you need to do that for type inference as well
Jul 16, 2024 15:37
that's basically doing a dry run but instead of values on the stack you have their types on the stack
Jul 16, 2024 15:36
so you need to keep track of what's on the stack as you evaluate things
Jul 16, 2024 15:35
the neat part is that you can then do auto a = b; and use b's type to decide a's type
Jul 16, 2024 15:34
the most basic of type inference comes from a+b where both a and b are integers, means that the result of the add is also an integer.

then recurse up the AST
Jul 10, 2024 14:26
then you don't need to look into the body to type check them
Jul 10, 2024 14:26
one thing that C++ did is make sure that the all the types of a template are derivable by just the signature
Jul 10, 2024 13:16
then when you instantiate the template you do full type checking, adding other templates to the instantiation queue as needed
Jul 10, 2024 13:15
when you compile a template you only do minimal type checking (as in any time a placeholder type is involved you just skip and mark the result as a placeholder as well)
Jul 10, 2024 13:07
if type inference is one way then it's always the easy part
Jul 10, 2024 13:07
with parametric polymorphism you create a AST with placeholder types that you duplicate and fill in the types as you figure out the concrete type that needs to go there
Jul 10, 2024 13:04
then you don't need to recurse constantly
Jul 10, 2024 13:04
you can assign that type explicitly in your AST structure
Jul 10, 2024 13:03
type inference, you mean when you have b+c you need to assign a type to the result of that add?
Apr 5, 2024 15:24
and it lets you write sleeps and waitfors in the animation functions without actually blocking execution
Apr 5, 2024 15:24
that's great for games where you need to return to the main loop to let other things run (like actually moving the character to the trigger for the next step in the animation)
Apr 5, 2024 15:23
half the point of coroutines is that you can "suspend" execution of a function and resume it later
Apr 5, 2024 15:22
coroutines is not multithreading
Apr 5, 2024 13:10
I prefer advocating for explicit statemachines, but the lack of in-between version between clean linear coroutine and full ad-hoc (& spaghetti) state machine is an issue
Apr 5, 2024 13:08
so you can have

doaction1();
yield await action1Done();
action2();
Apr 5, 2024 13:08
animation tends to be the reason
Mar 5, 2024 10:44
the more obscure shorthands you have in the language the less understandable it becomes at a glance
Mar 5, 2024 10:43
@mousetail shorthands are overrated
Mar 4, 2024 15:17
why do you need single symbols for that?
Nov 17, 2023 13:59
like the colored functions discussion
Nov 17, 2023 13:48
With that understanding: one concrete usecase for this would be coroutines where you can only await from within a scope that is async.

Another usecase might be methods that should only be executed from within a mutex' scope.
Nov 17, 2023 13:47
If I understand a "Lee space" correctly is that you have annotated methods which can only be called from a special scope. And entering such a scope may require special operation.
Aug 8, 2023 14:49
that should only on error and for emitting debug
Aug 8, 2023 14:48
how often do you need to reconstruct the line and column?
Aug 8, 2023 14:46
that way you don't need to allocate space for the text in the token
Aug 8, 2023 14:45
you can keep the entire file in memory and just have offsets
Aug 8, 2023 14:41
and when you need to print you can then use that to rediscover the line number
Aug 8, 2023 14:41
it can be just an integer offset into the file
Aug 8, 2023 14:31
it's better to make them as clear and as explicit as possible
Aug 8, 2023 14:31
error messages are part of the language's interface,
Jul 23, 2023 12:41
25
Q: Why is mov turing complete?

schuelermineI found this recently: https://github.com/xoreaxeaxeax/movfuscator It seems to be contingent on the fact that mov is turing-complete. Is that true, and why?

 

 Home Improvement

General discussion for diy.stackexchange.com
Feb 22, 2024 09:36
can I get an opinion on spam or not? https://diy.stackexchange.com/questions/293965/finding-the-perfect-home-cum-portable-ev-charging-solution

Person says he's an EV owner but is looking for a portable EV charger that IME tends to come with the car. And he's asking for charing in a mall car park where the chargers would have the cable to connect to the car already.

So IMO it's a LLM generated blurb to hide the link to the store