eerolanguage / eero

Eero was a fully binary- and header-compatible dialect of Objective-C, implemented with a modified version of the Apple-sponsored LLVM/clang open-source compiler. It featured a streamlined syntax, Python-like indentation, and other features that improve readability and code safety. It was inspired by languages such as Smalltalk, Python, and Ruby.
https://web.archive.org/web/20171101134337/http://eerolanguage.org/
288 stars 7 forks source link

Format String Literal Syntax #28

Open pcperini opened 12 years ago

pcperini commented 12 years ago

Feature request to circumvent (String stringWithFormat: 'Hello %@%s', 'World', "!"):

Declaring strings from formats should be as easy as:

formattedString := 'Hello %@%s': 'World', "!" // format, ... 
// or
formattedString := ('Hello %@%s': 'World', "!") // (format, ...)
fabiopelosin commented 12 years ago

What about string interpolation?

formattedString := 'Hello #{'World'}!'
orta commented 12 years ago

string interpolation is better than a format string IMO

pcperini commented 12 years ago

might be a bit weird syntactically though. i like how python does it, so maybe something like:

world := 'World'
formattedString := 'Hello %world' // automatic interpolation from variables
// or
formattedString := 'Hello %world': {'world': world} // explicit interpolation from key/val pairs