lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Peter Hill:
> Lua provides some object 'syntactic sugar' allowing methods and such for
> those who like them but *until now* has never enforced this OO methodology
> on users. The new io library, however, seems to *require* using methods to
> read from general files.
>
> I have to say that I don't like this at all, and I also think it is very
> un-Lua (which like to keep things basic). It is also rather unnecessary.
> The io library could either provide an 'io.fread' command, or allow an
> optional file argument to the standard 'io.read'.

Peter Prade:
> well i guess you can always do an:
> io.fread = stdin.read
>
> to enable:
> io.fread(filehandle,format1, ...)
>
> if you dislike:
> filehandle:read(format1, ...)

Huh? I don't follow this.


> although i cannot understand why? do you want to avoid the additional
> operator ":" ?

Yes. It's not required for any module but this one -- making it a Lua
aberation. I personally rather dislike the "single dispatch" style and I'm
glad that (up until now at least) it has simply been an optional notation
provided for those who take a fancy to it in other languages.

It's just not needed.

Cheers,
Peter Hill.