[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Duck Typing?
- From: Sean Conner <sean@...>
- Date: Tue, 31 Jul 2018 11:51:19 -0400
It was thus said that the Great Gavin Wraith once stated:
>
> I would be interested to see examples of how to fake
> types, type classes, and other such concepts within
> Lua.
The snippit of code I presented in another thread [1] is a form of duck
typing. I'm working on a socket framework (to handle both TCP and TLS
connections via Lua coroutines) and I'm mimicking the Lua file operations.
Yes, I could create a FILE object from a TCP socket and use the normal Lua
functions, but that won't work for TLS. So my own versions of read(),
write(), close(), etc).
-spc
[1] http://lua-users.org/lists/lua-l/2018-07/msg00679.html