Godot's GDScript for Programmers: Static Types & Memory Safety

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

ความคิดเห็น • 23

  • @torb-no
    @torb-no 8 หลายเดือนก่อน +8

    I can't think of anyone better to introduce me to the basics of a new language than ContextFree.

  • @joethephish
    @joethephish 8 หลายเดือนก่อน +9

    As a user of Unity I did a double take when I saw you running a script @ 1:39 in headless mode in a fraction of second! Very cool that that’s possible.

  • @qwfp
    @qwfp 8 หลายเดือนก่อน +10

    I've been using Godot for a few years, but this video was really interesting nonetheless! Although I've never had a need to use `weakref` or `extends Object`.
    GDScript, unfortunately, still isn't fully a "real" programming language (i.e. some features I would expect from a "real" language are not there, such as mentioned Dictionary typing), but it's getting there and it's already the best option for making games in Godot (in my opinion :) )

    • @contextfree
      @contextfree  8 หลายเดือนก่อน +4

      I should add that I do consider GDScript a real language, even though I think more refinement would make it better.

  • @azi_and_razi
    @azi_and_razi 8 หลายเดือนก่อน +5

    Yeah, they plan to add gdscript compilation, but right now they are still in the phase of discussing what is better: AOT vs JIT. AOT will win probably I think.

    • @contextfree
      @contextfree  8 หลายเดือนก่อน +1

      Glad they're discussing it! I think AOT makes more sense personally, although having an interpreter still can be handy, and JIT might ok to support on platforms where it works well. Wasm as one GDScript target would be great, for example.

  • @djdavidj
    @djdavidj 7 หลายเดือนก่อน +1

    Very interesting video, thank you for taking the time to do this. Hope you do more advance stuff like this in Godot. Thanks

  • @UliTroyo
    @UliTroyo 8 หลายเดือนก่อน +2

    Ooo, awesome! I’d definitely play your game :)

  • @japedr
    @japedr 8 หลายเดือนก่อน +3

    I guess I understand the point you were trying to make, but I believe that using the ctypes module to prove that python is not memory safe is a bit like cheating. It is Python's escape hatch towards C/native land, so its use should be treated with the same care as Rust's unsafe.
    Aside from that nitpick, great video as always.

    • @contextfree
      @contextfree  8 หลายเดือนก่อน +1

      Second complaint I've had on that point, and it's fair. Thanks for the feedback! That said, some parts of ctypes can be used safely. Like some parts have pros and cons vs `struct` pack and unpack in terms of the ability to model binary data. But there's also a variety of footguns even without calling native code. I suspect there could be clearer ways to make ffi without as many footguns on the local side. Maybe I should explore Vale's ffi sometime that claims to try to be safer than most. verdagon.dev/blog/fearless-ffi

    • @japedr
      @japedr 8 หลายเดือนก่อน +1

      Interesting, thanks for the link. I implemented myself that copy technique many times to protect against possibly rogue C/C++ code, so I see it could be quite useful to do it automatically. Then again, not having an option to bypass the copy could be problematic for performance in many cases (e.g. passing a buffer containing several GBs of data).
      Edit: Reading more carefully I really like some things it proposes, the second stack and the generational references tricks are quite clever.

  • @sporefergieboy10
    @sporefergieboy10 8 หลายเดือนก่อน +2

    This whole video would be one line of code in the Verse programming language

    • @contextfree
      @contextfree  8 หลายเดือนก่อน +4

      They already replaced the entire Internet with one line of Verse without anyone noticing. But more seriously, I have looked at Verse a tiny bit so far, and I'll probably look at it more again in the future.

    • @sporefergieboy10
      @sporefergieboy10 8 หลายเดือนก่อน +2

      @@contextfree it seems like Tim Sweeney’s passion project which makes it good content, but I’m extremely skeptical it will address any of the real problems unreal developers face but we’ll see

  • @foji-video
    @foji-video 8 หลายเดือนก่อน +1

    I mean, if you use ctypes you are basically using C directly... I would not take that as a "it's not memory safe", otherwise anything that supports a FFI is not safe

    • @contextfree
      @contextfree  8 หลายเดือนก่อน

      Fair point. Thanks for the thoughts! I've replied now to another comment in more detail. In particular, I should look more closely at Vale's ffi sometime to see what I can learn there. verdagon.dev/blog/fearless-ffi

  • @jonas1ara
    @jonas1ara 8 หลายเดือนก่อน +1

    Please Swift Godot

    • @contextfree
      @contextfree  8 หลายเดือนก่อน +2

      That could be fun.

    • @contextfree
      @contextfree  7 หลายเดือนก่อน +2

      So yeah, I guess I decided to try Swift Godot and also other languages. Thanks for the recommendation!

  • @CEOofGameDev
    @CEOofGameDev 7 หลายเดือนก่อน

    Godot != Python, that you can't deny.
    It's significantly worst than python...

    • @contextfree
      @contextfree  7 หลายเดือนก่อน +3

      What do you think is worse about it?