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

Compile errors using code on the website #20

Closed teodor-pripoae closed 12 years ago

teodor-pripoae commented 12 years ago

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.
pcperini commented 12 years ago

you need to #import <Cocoa/Cocoa.h> and #import <Foundation/Foundation.h>, and the interface for FileHelper needs to come before your use of FileHelper objects (remember: eero, while fancy, is still ObjC. also note that you might be able to get around this by specifying class FileHelper before main(), but I haven't tested it).

update: class FileHelper doesn't work, because you actually call the class's methods in main(). to circumvent, put either the interface or the interface and implementation before main(), or put the interface and implementation in another file and #import "FileHelper.eero"

claybridges commented 12 years ago

Seems like a reasonable first thing to do to try to compile that code. Perhaps, to avoid many others repeating this problem, it might be useful to put a prominent link on that page to a compiling version (e.g. a gist).

pcperini commented 12 years ago

@claybridges Or simply rewrite the main-page code.

andyarvanitis commented 12 years ago

Agreed. I rearranged the code and omitted some details to keep the front page compact, but in hindsight it wasn't a great idea. Keeping this issue open until I either change the code or create a link to a compiling version.

pcperini commented 12 years ago

here you go: https://gist.github.com/3080412

also, i've written a python script, eeroc (executable, just drop it anywhere in your $PATH, like /usr/local/bin) that wraps around eero's clang installation for ease of use. with regards to the demo code, you don't have to #import anything if you use eeroc, simply: eeroc demo.eero -X --autoframework, where -X specifies to compile with Cocoa, Foundation, and AppKit, and --autoframework slips those #import statements in for compiling.

andyarvanitis commented 12 years ago

Updated with compilable version link (which also includes build/run instructions in the header comments). More samples to follow on github. Thanks guys!