Giter Club home page Giter Club logo

eerolanguage / eero Goto Github PK

View Code? Open in Web Editor NEW
288.0 19.0 7.0 6.34 MB

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.

Home Page: https://web.archive.org/web/20171101134337/http://eerolanguage.org/

Objective-C 94.88% C 1.79% Objective-C++ 1.82% C++ 0.21% Shell 1.29%

eero's People

Contributors

andyarvanitis avatar waynezhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eero's Issues

source translation

if you could code in eero, and translate to objective-c, that would be a my last barrier to adopting eero.
what if eero no longer gets supported, i would just be able to use eero as a great source translation tool.

C++ interop mode only working with libstdc++

As of Mavericks, OS X builds default to using libc++ instead of GNU's libstdc++. However, eero's clang compiler currently only seems to work with libstdc++. Need to reconfigure how eero clang is built to properly recognize libc++. Both options should work.

Please do not reference Python when comparing language features.

The example code is no-where near Python-like in indentation, style, or readability. The indentation rules of Python clearly indicate scope nesting, whereas your front-page example clearly does not; the plus indicator with a space can easily be mistaken for an indentation level making the example's class method appear to be part of the previous scope.

The lack of clear scope designation (colon at the end of the local scope increment, e.g. if foo:) makes it very hard to read with two-space indentation (a level that no sane Python developer uses, we've standardized on four), unnecessarily verbose assignment operators (I'm assuming to differentiate from comparison), and what has to be the least obvious function declarations of any language I have ever seen. This snippet:

openFile: String path, withPermissions: String = 'readonly', return FileHandle

There is next to no visual distinction between arguments and return type, no clear designation as a function / method, and no scope operator. Standalone most people likely couldn't tell it apart from a one-line function what with the return keyword on the same line! It's unreadable and very, very un-Pythonic.

I'm pretty sure if Python were a person, it'd be ashamed to be associated with this syntax.

Quickly edited to add another jibe.

Compile errors using code on the website

I'm using the code listed here: http://eerolanguage.org/index.html

I'm getting the following compile error:


test.eero:2:13: error: use of undeclared identifier 'FileHelper'
  helper := FileHelper new  // declare variable "helper" via type inference
            ^
test.eero:4:12: error: NSArray must be available to use Objective-C array literals
  files := []  // empty array literal implies mutable
           ^
test.eero:7:7: error: use of undeclared identifier 'FileHandle'
  for FileHandle handle in files  // all objects are pointers, so no '*' needed
      ^
test.eero:11:3: error: expected expression
  return 0  // semicolons are optional almost everywhere
  ^
test.eero:11:3: error: expected expression
5 errors generated.

Compiler gets "stuck" after some errors

When finding/reporting an error, sometimes the parser gets "lost" when trying to proceed to the next bit of code. This is due to the inadequate handling of skipping to the next statement after discarding everything after the error (since semicolons are typically not present).

Semicolon required after enum declaration

An enum declaration is not properly terminated without a semicolon. Example:

enum { first,
       second, 
       third } // produces a compilation error without an explicit semicolon here 

Casts to types with protocol not working

Casts of the form

    numberArray := (Number<TypedArray>)array

are currently returning compilation error "Parameter name omitted". This should be a pretty easy fix.

Default method variable names in interfaces are ugly

Currently, the compiler generates ugly default variable names in interfaces (not in implementations). For example:

interface MyClass
   setObject id, withObject id  // generates var names "objectA", "objectB"
end

This was done avoid compiler warnings in interfaces for multiple parameters with the same name. The problem with these names occurs when the compiler emits other errors or warnings and references these names. At the very least, the first occurrence should not have any suffix (e.g. "object", "objectA").

Request: Derive Interface from Implementation

With the cause of reducing redundancy and the pain points of Objective-C I would like to request the following feature:

The interface section should be optional, and synthesized from the implementation — just like in Java, Ruby, Python, and most modern languages. The Implementation contains all the information needed to derive the Interface in all cases except when manifest constants (or the like) need to be declared.

@|some:method:| to mean NSStringFromSelector(@selector(some:method:))

Saw this tip in the recent NSHipster, which I think is good idea although it's crying out for a nicer syntax:

Passing strings as key paths is strictly worse than using properties directly, as any typo or misspelling won't be caught by the compiler, and will cause things to not work.
A clever workaround to this is to use NSStringFromSelector and a @selector literal value: NSStringFromSelector(@selector(isFinished))

I'm suggesting that the syntax @|isFinished| would fit nicely into eero. Forgive me if this is already in the language.

Also, even though there may be less call for using NSStringFromProtocol, why not use similar syntax on protocol literals, even if only for completeness?

Method calling syntax - add dot notation

I would love an optional dot notation syntax for calling methods, like Python and Ruby.

I've never enjoyed ObjC's [obj method:arg] syntax for method calling, particularly when method-chaining. Compare, using an example swiped from the internet:

[[NSOpenGLContext alloc] initWithFormat:[self pixelFormat]]

vs

OpenGLContext.alloc.initWithFormat(self.PixelFormat)

or even

OpenGLContext.alloc.initWithFormat self.PixelFormat

brew install eero

There is currently not a straightforward way to install. Brew support would be great.

clang: error: language not recognized: 'eero'

Installed XCode plugin. eero is in /usr/local/eerolanguage

Registered file type.

Added Test.ero file.

Compiled.

clang: error: language not recognized: 'eero'

Eero compiler is visible in Build Settings.

Automatic Reference Counting Bug

When using ARC, you need to provide annotations when casting in the form of __bridge, __bridge_transfer, or __bridge_retain for Core Foundation types.

I would expect this to work:

Array arr = (__bridge_transfer Array)my_cf_array 

Instead it requires the pointer to be specified instead of using implicit pointers like everywhere else.

Array arr = (__bridge_transfer Array *)my_cf_array 

Support for arrays of value types

One of the things in C++ that I miss in objective-c is std::vector. It would be nice if eero could have some sort of value type parameterized array.

Method declaration syntax

if i may bring up one valid subpoint of @amcgregor's issue: the plus indicator should probably retain it's counterpart, -, for instance methods.

maybe it's just a personal preference, but i often use the two at quick glances for determining (obviously) whether or not the method is a class or instance method. not having it also throws the spacing off (-;

lowering barrier to entry

If all that eero had was
optional semicolon, indentation as scope, optional parentheses around condition, message passing without square brackets and type inference
I think it is a huge improvement over Objective-C because they are used all the time.

I want to use switch to eero, but after reading the documentation, the list is pretty long. i have to remember a bunch of new stuff.

I think just changing @selector(someMethod:) to |someMethod| isn't really worth it. Even though it is more concise, It just increases effort for adoption.

Here are things that I think are really useful and things that I rather not have changed from objective c (even if eero makes more sense).

Optional semicolons +100
Off-side rule (indentation indicates block scope) +100
Optional parentheses around conditions +30
Message passing without square brackets +100

Objective-C keywords without ’@’ -10
Logical and bitwise operators and, or, not, etc. +10
The goto statement is illegal -10

Built-in symbol search on names with the “NS” prefix -10
User-defined prefix namespaces -10
Variables and literals +0

Object declarations are assumed to be pointers +10
Local type inference +30

No variable shadowing +0
NSString literals using single quotes +0
No ’@’ needed for array and dictionary literals +0

Mutable array and dictionary literals -10
Variable definitions using type inference and nil or Nil -10

Selector and protocol literals -10
NSRange literals (and expressions) using ‘..’ or ’…’ -10
NSRange variables and literals in for in loops -10
Underscores permitted in numeric literals +0
Stricter enum type checking +0

Method parameter type names are not enclosed in parentheses -10
Method parameters have default variable names -10
Method return type specified by trailing return, void by default if omitted -10
Methods are instance methods by default +10

Optional parameters and default arguments -10
Default return expression -10
No curly braces needed around member-variable declarations +10
Declarations of properties of the same type can be grouped together +0

Built-in equality and inequality comparison operators -10
Built-in ’+’ (binary version) and ’«’ string operators -10
Binary operators (effectively, operator overloading) -10
Array and dictionary subscript operators with integer and object indexes -10
Object subscript operators with NSRange indexes -10

Converting primitive data types to objects (boxing) +10
Converting objects to primitive data types (unboxing) +10

Blocks enhancements
Compact blocks -10
Nested functions (const blocks) -10

The switch statements
No fall-through +20
Comma-separated lists of cases +10
Case-value ranges -10

I think decreasing the number of differences between objective c and eero makes sense and only adopting differences that make a big impact in everyday coding would make the transition to eero easier.

I know this would make eero not as pure and clean, but It would still be a lot better than objective c.

Semicolon required after struct declaration

A terminating semicolon is required after struct declarations. Example:

struct _mystruct { int a
                   int b } // semicolon needed here

Note: This is not the same error as the enum error. This one generates an "error: expected ';' after struct" compilation error instead of just continuing to parse the next line.

Property declaration of Class type requires "*"

Properties declarations should behave like other declarations and treat classes as pointers implicitly. For example,

property (readonly) String*  highlightColorDefaultsKeyName

should not requre the trailing "*" after "String".

Feature: String interpolation

Have you considered removing the need for [NSString stringWithFormat:...] by creating a way to interpolate strings?

I'm thinking similar to how Ruby/Coffeescript allows this with "My name is #{name}"

Considering how often the compiler complains about incorrect format specifiers (e.g %d instead of %ld), it would be great if you could just look at the type and perform the substitution with the default specifier for the type.

Compiler crash with undeclared indentifier

Compiler crashes after use of certain undeclared identifiers. Example:

AutoreleasePoolX pool := new
...

Yields

cast.ero:7:3: error: use of undeclared identifier 'AutoreleasePoolX'

followed by crash at token 'pool'

Macros and escaping to Objective-C code

The biggest problem I encountered playing with EERO is compatibility with CPP macros. This prevents Sen, Kiwi, Reactive Cocoa, etc. from working properly.

I think the obvious solution is to add syntax to escape to standard Objective-C and insert code that would otherwise be invalid in EERO. Ideally EERO should also automatically escape for CPP macros from non-EERO source files so they just work. Parameters to the macros would need to be excluded. This may also be useful for embedding C++ code that would otherwise have problems.

Example: (using "begin_objc { … }" as example syntax)

implementation

eeroMethod, return String = 'eero side'

begin_objc {
- (NSString *)objcMethod {
    return @"objc side";   
}
}

eeroMethod2, return String
    begin_objc {
        return [self objcMethod];
    }

eeroMethod3, return String
    return MY_OBJC_MACRO('arg 1', 'arg 2')

end

Remove need for "return" keyword in compact blocks.

This was a request/suggestion made by a user via email. Compact blocks (not normal blocks) would implicitly return the result of the expression. Also consider allowing "return" keyword to be optional. Example compact blocks from documentation page would change to:

xyblock := (int x, int y | x + y)

descriptions := mylist.mapWith: (id element | element.description)

switch cases are falling through

In the current build, cases are no longer automatically breaking. The blog front page example fails:

    switch descriptor // no fall-through between cases (breaks not needed)
      case 0, 1, 2
        NSLog( 'stdin/out/err' )
      case 3 .. INT_MAX
        NSLog( 'regular file' )
      default
        NSLog( 'bad descriptor' )

Method prototype immediately followed by parens or brackets...

Bracketed expression is erroneously parsed as part of the prototype. A semicolon after the prototype makes it parse correctly.

Example:

setName String, length unsigned int

  [System log 'Here']  // gets associated with prototype above and produces error

Format String Literal Syntax

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, ...)

Consider changing class and interface declaration terms

This might be a silly idea, but I'll raise it anyway. I recently watched a WWDC video where Blaine Garst (WWDC 2010 Session 113 "Working Effectively with Objective-C on iPhone OS" at around 23:30) lamented the fact that because "@interface" is already used to declare a class, it is not available for declaring interfaces, which are therefore declared as "@protocol".

A new syntax for Objective-C might be the opportune place to let people declare a class with "class", and an interface with "interface". I'm not sure whether this would create less, or more confusion for existing Obj-C developers, but it would be very likely to be better for developers from any other language. Which audience is eero more targeted at?

Or there might be technical reasons that this is a bad idea.

autoreleasepool by default

I'm not exactly sure what I'm expecting here (i.e., int main() should implicitly include a call to autoreleasepool, or something else entirely), but having to manually "wrap" (read: "stick arbitrary header before") code just to handle autoreleasing feels... out of sync with the ethos of the project.

Totally a feature request, and a very unimportant one at that, but something about:

int main()
    autoreleasepool
        (myObject doStuff)

feels 1 level too deep.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.