wanderwaltz / ocsquirrel Goto Github PK
View Code? Open in Web Editor NEWStatic framework for Squirrel (http://squirrel-lang.org) capable of being used in iOS applications.
Static framework for Squirrel (http://squirrel-lang.org) capable of being used in iOS applications.
Idea is the following: create OCSquirrelTable
class which inherits NSMutableDictionary
and conforms to <OCSquirrelTable>
protocol. It will contain OCSquirrelTableImpl
as a private property and will forward <OCSquirrelTable>
protocol's method calls to this property.
Make OCSquirrelVM
return OCSquirrelTable
instances from OCSquirrelVM+SQObjects
category methods. That way the actual implementation of OCSquirrelTableImpl
stays encapsulated while we still have all NSDictionary
-like functionality and more.
OCSquirrelVMStack
currently returns OCSquirrelArray
and OCSquirrelTable
(which are subclasses of NSMutableArray
and NSMutableDictionary
respectively) instances from -valueAtPosition:
, but does not allow pushing NSArray
or NSDictionary
directly (they are not converted to corresponding Squirrel collections).
Make a new <OCSquirrelArray>
protocol and rename existing OCSquirrelArray
class into a protected OCSquirrelArrayImpl
.
Squirrel has cloning API for objects, so we should add <NSCopying>
support to all of the protected OCSquirrelObjectImpl
subclasses and their corresponding public incarnations.
Currently interaction of objects bound to different VMs is not supported (i.e. you cannot set object from one VM as a member of a table in another VM), and therefore exceptions (probably NSInvalidArgumentException) should be thrown in case of any inconsistencies between interacting objects' VMs.
Make a new <OCSquirrelObject>
protocol which provides access to the linked OCSquirrelVM
, but hide all other unnecessary APIs into the protected OCSquirrelObjectImpl
class.
Make sure other protocols for Squirrel objects (such as <OCSquirrelArray>
, <OCSquirrelTable>
etc.) also inherit <OCSquirrelObject>
protocol.
We'll need runtime block introspection for this, which may be considered unsafe or hacky. But since this whole project is more or less made just for fun, I'll probably add this in the future anyway.
Should probably @throw NSInvalidArgumentException
when trying to set negative top value or value exceeding current top.
Different OCSquirrel API methods use different naming conventions for the same things (inVM:, inSquirrelVM: as an example, also -enumerateObjectsAndKeysUsingBlock: vs -enumerateKeysAndObjectsUsingBlock:)
It will be better to make these consistent.
Exposing HSQOBJECTs and HSQUIRRELVM directly leaves to much space to break things apart. If we can provide everything needed using only Objective-C API, raw Squirrel API will be better completely encapsulated.
This also means not importing the squirrel.h and scalar Squirrel types.
Create OCSquirrelArray
class which inherits from NSMutableArray
and conforms to <OCSquirrelArray>
protocol. It will have a private property of OCSquirrelArrayImpl
class and will forward method calls of <OCSquirrelArray>
to this property.
Make OCSquirrelVM
return instances of OCSquirrelArray
from its OCSquirrel+SQObjects
category.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.