welcome to
objective-c, evolved.
| coming soon: universal dot notation |
what is eero?
Eero is 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 features a streamlined syntax, Python-like indentation, and other features that improve readability and code safety. It is inspired by languages such as Smalltalk, Python, and Ruby."Eero" is pronounced [ˈe-rō]‚ and is similar to the English word "aero".
code sample
(A compilable version with instructions can be found here.)int main() helper := FileHelper new // declare variable "helper" via type inference files := [] // empty array literal implies mutable files addObject: (helper openFile: 'readme.txt') // can group message in parens for FileHandle handle in files // all objects are pointers, so no '*' needed Log('File descriptor is %@', (Number)(handle fileDescriptor)) // NSLog() call handle closeFile return 0 // semicolons are optional almost everywhere interface FileHelper // NSObject is implicit superclass when not specified // Similar properties can be grouped together property (readonly) String volumeName // "String" is the same as "NSString" String volumeFormat // A class method. Methods are instance methods by default ('-' is optional). + pathStringWithComponents: Array, return String // An instance method. The brackets make parameter "withPermissions" optional. openFile: String, [withPermissions: String], return FileHandle end implementation FileHelper // no '@' needed for any objc keywords // "{}" braces are optional for instance variables private int iBytesUsed int iBytesFree // "components" is the default arg variable name for "pathStringWithComponents" + pathStringWithComponents: Array, return String fullPathName := '' // empty objc string literal implies it is mutable for String component in components fullPathName << '/' + component // string concatenation with '+' and '<<' return fullPathName // "withPermissions" was declared optional, so a default value is defined here openFile: String path, withPermissions: String = 'readonly', return FileHandle FileHandle handle = nil if permissions == 'readonly' or permissions == 'r' handle = FileHandle fileHandleForReadingAtPath: path else if permissions == 'readwrite' or permissions == 'rw' handle = FileHandle fileHandleForUpdatingAtPath: path return handle end