lua-users home
lua-l archive

Re: Thoughts on new syntax for toclose

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


It was thus said that the Great Dibyendu Majumdar once stated:
> The latest commits show the syntax <toclose> being adopted instead of *toclose.
 There's also <const> as well. But you can't combine them:
	do
	 local <toclose> f = io.open(foo)	-- okay
	 local <const> x = 5			-- okay
	 local <toclose> <const> g = io.open(bar) -- error
 local <const> <toclose> h = io.open(baz) -- also error
	end
> Aesthetically I find the new syntax to be nicer, but this still has
> the problem that the previous syntax had; which is that the symbol '<'
> has meaning in expressions therefore using this symbol (like the *
> symbol) may restrict the ability to use extensions inside expressions.
> Of course extensions will always be restricted to local declarations
> in which case it doesn't matter.
	do
	 local *toclose f = io.open(foo)
	 local *const x = 5
	end
	do
	 local @toclose f = io.open(foo)
	 local @const x = 5
	end
 Eh. I tend to prefer the '@' syntax, but only because '@' has no current
use in Lua. But I can live with this.
 But the latest manual for Lua 5.4 still mentions the old syntax.
 -spc

AltStyle によって変換されたページ (->オリジナル) /