PtokaX forum

Development Section => HOW-TO's => HOW-TO requests => Topic started by: Mardeg on 02 September, 2006, 05:30:44

Title: Lua implementation of Design By Contract
Post by: Mardeg on 02 September, 2006, 05:30:44
DBC wiki article: http://en.wikipedia.org/wiki/Design_by_contract

Looks like it's a way to generically verify that a call to a function guarantees that it's sending any/the correct input and also that the function called guarantees to return correct output.
Possibly also a way to correctly throw an error accurately pinpointing the source of the error, instead of just having the error pointing to the location of the DBC verification code.

An example using the Javascript language is at http://weblogs.mozillazine.org/weirdal/archives/016921.html

Can anyone think of a possible use of this which isn't just an unnecessary extra layer of abstraction? If so, how to implement?
Title: Re: Lua implementation of Design By Contract
Post by: Herodes on 02 September, 2006, 22:31:50
first think that we need to get a grasp of the Object Oriented programming that Lua may offer ( using the tables (the skeleton) and the functions (the muscles), but also the module system in Lua 5.1) for orchestrating actions for using within PtokaX (this is a direct implication that PtokaX may need a more accessible-open-alterable API,... so maybe forget about it cause I think that it is more trouble that its worth for PPK (doing the business may not mean reinventing the wheel))....

seconldy I think that things should get  any more complicated in PtokaX,.. since this is a Lua proposal that should be posted in the respective mailing list and get the feedback from the people that know Lua's guts and skin and comprehend them better than anyone of us since they do it for a living nad we do it as a hobby,...

One the other hand maybe you are right and that we need some more science,.. but gimme profit and I'll do my studies,...