
On 1/4/2012 11:00 PM, Thomas Heller wrote:
let(_a = 1)[...] I think the let syntx is a worse way, and you may make some mistak of my way. The let syntx is quite different from the C++ style, and _a ... _z are limited.
The let syntax was chosen to mimic the style of traditional functional programming languages. Which is in contrast to the initial advertisement of phoenix stating it is "C++ in C++". In fact, the scope module is probably the place where Phoenix differs the most from traditional C++ syntax. Mainly due to the fact that things like this weren't really possible in C++ when Phoenix was invented. Joel might have some more insight on his motivation to chose that syntax!
It was designed with uniformity with the lambda syntax. let is more FP than procedural and closely resemble the lambda syntax. It is certainly possible to have an alternate local variable syntax similar to what you propose since a local scope does not introduce a new scope like lambda does.
However, I agree, that having a "free style identifier" name would greatly improve Phoenix.
Sure!
I am one of the authors, Joel de Guzman is the main author and inventor of Phoenix. Patches and ideas are always welcome!
Definitely! Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com