Static Type Checking (Porth Ep.15)

preview_player
Показать описание
References:

Support:

Feel free to use this video to make highlights and upload them to YouTube (also please put the link to this channel in the description)
Рекомендации по теме
Комментарии
Автор

I feel like *a lot* of duplicate code could be generalized into a single function like ensure_enough_args(...), which would make the code a lot clearer and terser

lnus
Автор

39:20 In Python you could also write `a_type == b_type == Type.INT`. Works for all comparison operators and expands to `a_type == b_type and b_type == Type.INT`. Something like `a <= x <= b` is also valid and produces the expected results. One of my favorite Python features. :D

50:30 I'm unsure if you are correct about webassembly not alloying to leave values on the stack in a loop. The WASM Verification Step URL, from the description, mentions exactly that in the "Expression-based Control Flow"-section.

Blubbrbub
Автор

also Tsoding. youd get a lot more speed with your simulation if you used deque for your lists. it provides O(1) time complexity for all pop and append operations. i know pypy speeds things up now but it might be worth looking into.

Mekelaina
Автор

So, when are you going to add dependent types? :)

welltypedwitch
Автор

[18:18] `voidf` error is the scariest thing I've ever seen. O_O

kaksisve
Автор

i literally have no fucking clue how to write code i just watch this to fall to sleep

flugncu
Автор

Blocking the while loop from popping beyond a stopper in the stack seems very restrictive and unnecessary. It's going to ruin the kind of iteration that he was using earlier where he stored the values of the iteration on the stack and modified them each time through the loop. Why not just store a copy of the stack when we get to "while" and then confirm that the stack matches that copy when we get to "end"? That way the loop is free to modify the values on the stack so long as it doesn't change the size of the stack or the type of the values.

We would also want to store a copy of the stack when we get to "do" and then when we get to "end" we can replace the current stack with the copy we made at "do" so that the rest of the type checking can reflect the state of the stack when a "do" check fails.

Ansatz
Автор

i dont think a non empty stack at the end of the program is an error, as you may want to return an exit code.
Also it would be nice to see multiple error messages before the compilation is aborted.
And for include it would be nice to see the location the file was included in, just like modern compiler (gcc, clang) error messages with different levels like info warn and error and a switch to turn warnings into errors.

wChris_
Автор

Will you use pythons 3.10 (released on Monday the 4.10.21) new match syntax?

paulfragemann
Автор

Возможно, стоит завести не специальный элемент для определения границы блока, а скорее завести отдельный стек в который пушить размер стека в начале блока, а когда встречается энд сравнивать текущий размер стека с размером стека который последний в стеке

whiteandy
Автор

i like your vids
you deserve more subs 1000%

ynav
Автор

static type checking lets fucking goooo

Mekelaina
Автор

for the while and do over/underflow problem; why dont you save the stack size at the WHILE operation and compare it at the END operation

wChris_
Автор

You should definitely consider the vim bindings for your emacs.... :-D

mathiaz
Автор

Damn I remember watching you when u were a morbid creature. Congrats on coming a long way mate.

rahulprasad
Автор

Null safe type checking is overkill. Just make it function without strong type with the option to make it strongly typed if the user actually wants.

rudrapratapsinha
Автор

39:20 one of the reasons you're unemployed

connordechart
Автор

```for ip, op in enumerate(program):```

TheTmLev