Coder Social home page Coder Social logo

clojurem's People

Contributors

joshaber 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  avatar  avatar  avatar  avatar  avatar  avatar

clojurem's Issues

Invocation of plain C functions

Invocation of Objective C methods is straightforward:

(.layer CA/TextLayer)

compiles into

[CATextLayer layer];

as expected.
It's not clear how to invoke plain C functions though (e.g., CGRectMake(0, 0, 100, 100);)
Is this a big enough issue in the Objective C / Apple ecosystem that Clojurem should have additional semantics for it, or should users just wrap whatever they need with objc* calls?

Building Example fails

Thanks for starting this project!

After generating/compiling the cljm file ... I tried to build the Example with Xcode but I got redefinitions? How can I help? Where to start? What to do?

CompileC DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/Objects-normal/x86_64/hello_DOT_core.o gen/hello_DOT_core.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/axel/Projects/clojurem/examples/DemoApp
setenv LANG en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-sign-compare -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -fasm-blocks -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.7 -g -Wno-sign-conversion "-DIBOutlet=attribute((iboutlet))" "-DIBOutletCollection(ClassName)=attribute((iboutletcollection(ClassName)))" "-DIBAction=void)attribute((ibaction)" -iquote /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DemoApp-generated-files.hmap -I/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DemoApp-own-target-headers.hmap -I/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DemoApp-all-target-headers.hmap -iquote /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DemoApp-project-headers.hmap -I/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Products/Debug/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DerivedSources/x86_64 -I/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/DerivedSources -F/Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Products/Debug -include /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/PrecompiledHeaders/DemoApp-Prefix-csxrtyeqypyjvihhjdqznwlyxuty/DemoApp-Prefix.pch -MMD -MT dependencies -MF /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/Objects-normal/x86_64/hello_DOT_core.d --serialize-diagnostics /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/Objects-normal/x86_64/hello_DOT_core.dia -c /Users/axel/Projects/clojurem/examples/DemoApp/gen/hello_DOT_core.m -o /Users/axel/Projects/clojurem/examples/DemoApp/DerivedData/DemoApp/Build/Intermediates/DemoApp.build/Debug/DemoApp.build/Objects-normal/x86_64/hello_DOT_core.o

In file included from /Users/axel/Projects/clojurem/examples/DemoApp/gen/hello_DOT_core.m:3:
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:576:12: error: redefinition of 'cljm_DOT_core_SLASH_TransientVector' as different kind of symbol
@interface cljm_DOT_core_SLASH_TransientVector : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:529:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_TransientVector;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:646:12: error: redefinition of 'cljm_DOT_core_SLASH_TransientArrayMap' as different kind of symbol
@interface cljm_DOT_core_SLASH_TransientArrayMap : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:634:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_TransientArrayMap;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:686:12: error: redefinition of 'cljm_DOT_core_SLASH_ArrayNode' as different kind of symbol
@interface cljm_DOT_core_SLASH_ArrayNode : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:675:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_ArrayNode;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:739:12: error: redefinition of 'cljm_DOT_core_SLASH_TransientHashMap' as different kind of symbol
@interface cljm_DOT_core_SLASH_TransientHashMap : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:726:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_TransientHashMap;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:768:12: error: redefinition of 'cljm_DOT_core_SLASH_BlackNode' as different kind of symbol
@interface cljm_DOT_core_SLASH_BlackNode : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:761:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_BlackNode;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:778:12: error: redefinition of 'cljm_DOT_core_SLASH_RedNode' as different kind of symbol
@interface cljm_DOT_core_SLASH_RedNode : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:760:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_RedNode;
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:824:12: error: redefinition of 'cljm_DOT_core_SLASH_TransientHashSet' as different kind of symbol
@interface cljm_DOT_core_SLASH_TransientHashSet : NSObject
^
/Users/axel/Projects/clojurem/examples/DemoApp/gen/cljm_DOT_core.h:814:10: note: previous definition is here
CLJMVar *cljm_DOT_core_SLASH_TransientHashSet;
^
7 errors generated.

script/bootstrap dependency on Google Closure Compiler?

I'm getting an error when running script/bootstrap, does closure/compiler/compiler.jar currently referred at line 17 on script/bootstrap happen to be from Google's Closure compiler (since it's based on ClojureScript)? In that case I'll have a pull request for you. Cheers, Jacob (nice project btw, just what I was looking for).

I suspect this since my run of script/bootstrap gave this (with an added set -x for clarity):

superfly ~/src/ext/obj-c/clojurem$ ./script/bootstrap
+ mkdir -p lib
+ echo 'Fetching Clojure...'
Fetching Clojure...
+ curl -O -s http://repo1.maven.org/maven2/org/clojure/clojure/1.4.0/clojure-1.4.0.zip
+ unzip -qu clojure-1.4.0.zip
+ echo 'Copying clojure-1.4.0/clojure-1.4.0.jar to lib/clojure.jar...'
Copying clojure-1.4.0/clojure-1.4.0.jar to lib/clojure.jar...
+ cp clojure-1.4.0/clojure-1.4.0.jar lib/clojure.jar
+ echo 'Cleaning up Clojure directory...'
Cleaning up Clojure directory...
+ rm -rf clojure-1.4.0/
+ echo 'Cleaning up Clojure archive...'
Cleaning up Clojure archive...
+ rm clojure-1.4.0.zip
+ echo 'Copying closure/compiler/compiler.jar to lib/compiler.jar'
Copying closure/compiler/compiler.jar to lib/compiler.jar
+ cp closure/compiler/compiler.jar lib
cp: closure/compiler/compiler.jar: No such file or directory

iOS support

I've been hacking on clojurem to try and get it to build for iOS.
Here are some notes in case anyone else wants to play along / lend a hand.

Start a new XCode project targeting iOS, then

  1. add the runtime header path (e.g., ../vendor/clojurem/runtime/CLJMRuntime) to the build settings
  2. add your generated Objective C files to the target build phases -> compile sources list

One family of errors I'm getting comes from differences in literal support between iOS 5.1 and OS X 10.8 (see StackOverflow).
This can be fixed up by changing the appropriate lines of compile.clj to use the method call.
E.g.,. turn

(emitln "id " (munge param) " = cljm_args[" i "];"))

into

(emitln "id " (munge param) " = [cljm_args objectAtIndex:" i "];")

However, there are still a ton of other semantic errors, and it's pretty clear that things are blowing up because of JavaScript cruft---references to object prototype chains or google's closure library functions.
How come these don't show up in the DemoApp project?
That project doesn't include the core cljm file in its compile sources list, but presumably that was complied successfully somewhere and is getting pulled in.

Refactoring

Hi Josh,

you mentioned a big refactor that you'd like to take place. Maybe I can contribute further stuff (besides a slight doc improvement)? Can you give a short overview of what you'd like to have as an outcome of the refactoring?

  • Axel

Respect type hints

We currently don't do anything with type hints. We should.

Note that we'll also need hints for IBOutlet, IBAction, etc.

Demo App build fails with "use of undeclared identifier" errors

Trying to compile the demo app in commit 50d022d in XCode 4.3.3 (OS X 10.7.4) gives errors about undeclared identifiers in the ObjectiveC runtime library.

For instance, there's an error about this method in CLJMList.m:

- (id)initWithHead:(id)head tail:(CLJMList *)tail {
    self = [super init];
    if (!self)
        return nil;

    _head = head;
    _tail = [tail copy];

    return self;
}

I don't know anything about ObjectiveC conventions---are underscores shortcut field accesses?
Do I need to turn on some compiler magic in XCode for it to recognize this?

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.