lua-users home
lua-l archive

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


On Thursday 23 October 2003 04:24, Vijay Aswadhati wrote:
> Since you have mentioned that you are still
> undecided on an 'alternative' format, perhaps it is not too late to point
> out reStructuredText as an alternative.

Actually, I meant "alternative" as in "a format for specifying alternative 
return values". For example:

function foo( a )
	if type(a) == 'string' then
		return a, string.len
	else
		return nil, 'not a string'
 	end
end

What types of values does this function return? I want to either say that it 
returns "a string and a number" or "nil and a string" OR that the first value 
is "a string or nil" and the second "a number or string". Conditional return 
values, etc. So I need some kind of intuitive markup for that, e.g.:

--: (string|nil) the string itself, or nil if a was not a string
--: (number|string) the length of string a, or an error message if it 
--- was not a string

...something like that. Maybe

--: if parameter a is a string
--: (string) the string itself
--: (number) its length
--: if the parameter is not a string
--: (nil) nil value
--: (string) error message

Ack. But that's way too big, although pretty easy to parse.

> You can find more information at http://docutils.sourceforge.net/rst.html
> Having a tool that understands reStructuredText would be a nice incentive
> to woo Python users to Lua!

I did like to check the reference out, thanks a lot for that. I've been 
looking into simple markups recently, and it was very nice to find out about 
reST. My main problem with it is its dependance on indentation (not an issue 
for the Python people, of course >: ) ), which makes it unfit for some of my 
purposes, but other than that is pretty nice.

> Just my two cents, not fully understanding ExpLua's goals and needs.

Nah. They're not that complicated. >; )

Thanks for the input,

	Pedro.