red-blox / zap

A lightning fast networking solution for roblox.
https://zap.redblox.dev
MIT License
95 stars 15 forks source link

Remove returning `table.freeze` #128

Closed Ketasaja closed 2 months ago

Ketasaja commented 2 months ago

table.freeze inconsistently causes firing events with Zap not to typecheck at all in the old solver. From testing it's when table.freeze is combined with --!nocheck or --!nonstrict and called into from a --!strict module.

table.freeze is bugged in the new solver, and even if that were fixed the new solver isn't yet quite ready for general use.

It should be added back later, which would be easy.

sasial-dev commented 2 months ago

I'm not convinced about this. It seemed to be working fine for me in Luau LSP? Do you find this issue in VSCode or only in studio?

I also would like @kalrnlo's opinion as they originally PR'ed in #97.

witchiestwitchery commented 2 months ago

I'm ok if it gets removed for rn tbh

Ketasaja commented 2 months ago

VS Code, Luau-LSP 1.32.1. Luau has issues specifically with calls from strict into nonstrict mode. I use table.freeze in all my code (I use old solver and strict mode everywhere), table.freeze is correct to return from Zap, my PR is meant to be temporary.

--!strict
local network_client = require(script.network_client)

network_client.test.fire({}) -- no error unless `table.freeze` removed, or generated output is --!strict instead of --!nocheck
opt casing = "snake_case"
opt client_output = "src/client/network_client.luau"
opt server_output = "src/server/network_server.luau"

event test = {
    from: Client,
    type: Reliable,
    call: SingleSync,
    data: f64,
}