Exp Lua |
|
最近的 explua tarball 可以在此 Wiki 找到:Files:wiki_insecure/users/miller/explua.tar.gz請注意,這是個公開網站,因此程式碼本質上不可信。首先,封包中只能有Lua 檔案。
一個 LaTeX(好吧,之後使用我自己的巨集等等轉換成 PS)範例可以在此找到:Files:wiki_insecure/users/miller/concur.ps.gz。
On Sunday 19 October 2003 20:32, Reuben Thomas wrote: > I intend to fix on a system to use soonish (to make the libraries more > easily usable), so it would be nice to know how ExpLua works even if it's > not ready yet.好的。我一直採用適應性、進步性的反覆精進方法來開發這個系統,也就是有時花個 20 分鐘左右組裝一下,有時則是在整晚調整大量的組成要素並進行設計、建置和測試,主要目的是為了自動化整理我論文中函式和模組的說明文件(裡面有很多,而且我不想寫兩次並維護兩個版本)。
一開始,我嘗試使用其他現有的系統(例如 LuaDoc?、JavaDoc?,甚至文藝編程),但發現它們往往會過於阻礙我的不良編程習慣。遺憾的是,它們並不足以讓我有動力改掉缺點,開始正確地進行設計,我最後都只會因為打 @param 標籤感到疲累而放棄撰寫註解。
於是我認為,我想要一種在編寫程式時可以更簡潔輸入,即使不懂特定註解格式也能夠輕鬆閱讀的註解系統。我選定了一個如下所示的符號系統
針對整個檔案
--| Begins a module/file comment, e.g., "this file does *this*". --by Pedro Miller Rabinovitch <miller@inf.puc-rio.br> --$Id: myfile.lua,v 1.12 2003/10/17 00:13:56 miller Exp $ --TODO lots of stuff.
在每個函數之前
--% This is the purpose of the function, i.e., what it *does*. --- And this is the second line, which will concatenated to --- the others. --@ first (string) Text of the first parameter --@ what (table) The second parameter is the table used for an --- example --@ [...] (any) Optional parameters to the called whatever --: (number) Number of whatevers done or nil if an error occured function Module:MyFunction( first, what, ... )
基本上就先到這邊。我已經規畫了更多後續事項(例如 --& 和 --.,分別用於重要的表格和欄位,而且我之後也會需要一種類型定義),但重點已經寫出來了。
最讚的是,它現在變得如此簡單,我可以編寫更多我的程式文件。而且我撰寫的程式文件越多,我就越想要擷取並產生一些東西...
言簡意賅。我還有更多要討論的,但現在沒有時間。