On 03/08/2014, at 4:16 PM, Jeffrey Beu wrote: > Having a look a Felix I came away really impressed. Love the array type > signature/definition/constructor.. whatever it is called. It seems a really > thought out language - not sure about the generator business - that > integrates with C/C++, seems almost perfect.
It was designed to leverage C/C++ libraries (although support for OO is weak). in Felix functions are not allowed to have side effects. For example: var y = 1; fun f(x:int) : int = { ++y; return y + x; } This is not allowed. You are supposed to use a procedure instead: proc g (x:int, result: &int) { ++y; result <- y + x; } However this is so clumsy to use: var result: int; g (1); // now we can use result in an expression and it make binding C functions that DO have side effects quite hard. For example .. ALL of Posix. So I decided to allow a special kind of function with side effects, called a generator: gen f(x:int) : int = { ++y; return y + x; } Generators can be used in an expression. When used directly: var something = 1 + f (42) * 6; Felix promised to lift the generator out like this: var tmp = f (42); var something = 1 + tmp * 6; so it cannot be evaluated more than once. Generator expressions are "unravelled" into assignments to temporaries in a fixed order (namely, by recursive descent analysis of the expression) so any interaction between the side effects is deterministic. The exemplar generator is rand(). But here's another one: var init = 0; gen fresh() = { var tmp = init; ++init; return tmp; } which generates a sequence of integers, i.e. a fresh integer on each call. > My questions are does it work It works .. modulo the usual bugs any system has. > and will I have problems with the runtime on these mobile platforms I have a friend that got Felix to build for various variants of iPhone platforms. Now, recently, the run time driver code was changed as follows: previously, Felix ran its own driver loop. This would schedule the fibres. It also interfaced to the async I/O system. however many platforms, for example many GUI systems, and many cases where you're running an event loop for some reason and want to add Felix into the system, demand THEY are the master. There's no point running a master Felix loop inside a callback of an external event loop and losing all the state at the end of the function. So the driver was rewritten to use callbacks and a state object, so you can now embed Felix inside a foreign event loop, in the IDLE-TASKS callback or some other place you want. Of course this is a C/C++ coding job you have to do to get it embedded. Now as to Android I don't know BUT, Felix works with SDL, and SDL has the initialisation code for Windows, Linux, OSX, Android, and iOS. All the hell interfacing C code to Java has been done in SDL. Of course Android isn't Java, its Linux, so underneath its all C, curses on Google for using a Java API but there you go :) > - it is the threads/asnyc stuff that has me concerned. You do not have to use the async stuff. It is optional. There are actually two drivers: flx_run flx_arun The flx_run driver does not do any async I/O. The flx_arun driver loads the async I/O library on demand. It does this because if you use this driver, but actually don't do any async I/O, it saves the overhead of starting the event polling thread. On the other hand, threading at the moment is mandatory. The GC has two variants: a non-thread safe one and a thread safe wrapper. The drivers use the thread-safe wrapper. At present there's no way to avoid it, although it should be easy to do. Unfortunately there is coupling between threads and the GC, so that the GC library has mutexes etc in it, even if you do not use the thread safe collector, the code for both GC variants is in the same library. Any help decoupling the code would be great. So the answer to the thread issue is that at the moment it cannot be avoided even if you don't use any threads, but in principle it shouldn't be hard to split up the code so a basic non-threading Felix could be used. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language