teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.02k stars 101 forks source link

fix io.read & file:read signature #718

Closed fperrad closed 8 months ago

github-actions[bot] commented 8 months ago

Teal Playground URL: https://718--teal-playground-preview.netlify.app

hishamhm commented 8 months ago

I think it's better to declare this as a polymorphic function so we don't have to use casts in the most common cases. I will try my hand at an alternative implementation, but thank you for the PR pointing out the issue!

fperrad commented 8 months ago

From Reference Manuals, available formats are:

The starting * is allowed in implementation of Lua 5.3 & 5.4, only for compatibily reason (see function g_read() in liolib.c).

It could be nice that Teal allows only Lua 5.3/4 formats, and the * will be added by the generation targeting Lua 5.1/2.