7 ms·
Factor: An impressive stack-based language environment
- eggy 8y agoI'll have to check out the new 0.98 release. I always enjoy playing with Factor, and I even wrote a program to munge data from a sensor many years ago for work. It's one of those languages that if it took off, I'd be happy to use it for work all the time. It is a lot of fun though!
- foldr 8y agoFactor is definitely very cool. Apart from being stack-based, it's also impressive for compiling to native code on Windows, Linux and OS X without going via LLVM or anything similar. It can even produce self-contained executables. IIRC, named local variables have been available as a library feature for a long time now, so you don't have to write in a concatenative style when it's cumbersome to do so.
- phoe-krk 8y agoIt basically has its own native compiler built-in, just like many Lisp, Scheme and Smalltalk implementations.
- pome 8y agoHow Factor compiler is different from something like SBCL? It's interesting because Factor have plans to support ARM/Android/iOS, how hard to achieve these goals? It's interesting because Common Lisp's (SBCL, CCL), Scheme (Chez Scheme), Smalltalk (Pharo, Squeak) also have native compiler's, but no one have iOS/Android support, SBCL also have self-contained executables and ARM port. What are the biggest problems to these projects from having iOS/Android support.
- 3rdAccount 8y agoSBCL & Chez are really fast. I don't remember Factor having very high performance.
- pome 8y agoThere are some old benchmarks (2010) - http://factor-language.blogspot.com/2010/05/comparing-factors-performance-against.html http://factor-language.blogspot.com/2010/05/comparing-factor... , in 2018 sure, situation I think is different.
- lispm 8y agoLispWorks has a native compiler and supports Android and iOS: http://www.lispworks.com/products/lw4mr.html http://www.lispworks.com/products/lw4mr.html The iOS situation is difficult, because Apple does not allow runtime compiled/loaded code in general. LispWorks pre-compiles Lisp code and one creates an App with the help of Apple's Xcode. LispWorks has still an Interpreter at runtime. Generally it is a very complete implementation of Common Lisp (minus the runtime compilation), but without a Lisp-based GUI library. They also had to write a special Garbage Collector for the 64bit ARM iOS. Seems like it was not possible to have their usually more advanced GC, which for example is available with their 64bit ARM Linux port of LispWorks.
- ppseafield 8y agoThat's not exactly Apple's policy - there are React Native apps in the iOS store, and that runs on nodejs. Apple specifically forbids applications that download and run code or allow for other code outside of the application's code to be run. I.e. any and all code that your application will execute has to be submitted with your app. https://developer.apple.com/app-store/review/guidelines/ https://developer.apple.com/app-store/review/guidelines/ specifically 2.5.2
- lispm 8y agohttps://code.janeasystems.com/nodejs-mobile https://code.janeasystems.com/nodejs-mobile > On iOS, V8 cannot run because the operating system forbids just-in-time compilation; so instead of V8, we use our own port of the ChakraCore engine, on top of the integration with Node that Microsoft created in Node.js on ChakraCore. ChakraCore has a well-optimized, pure interpreter mode which complies with iOS’ restrictions. http://www.janeasystems.com/blog/node-js-meets-ios/ http://www.janeasystems.com/blog/node-js-meets-ios/ > Apple does not allow Just-In-Time compilation on iOS (except for its own JavaScriptCore engine). So the claim is that Apple will not allow a third-party Javascript engine which provides a JIT - even though interpreted code engines are allowed and this is what their node.js version did. My impression is also that this is a technical restriction. Has that changed?
- 8y ago
- doublec 8y agoFactor used to have ARM support back in the days of Windows Mobile: https://bluishcoder.co.nz/2007/02/17/factor-on-windows-mobile-5.html https://bluishcoder.co.nz/2007/02/17/factor-on-windows-mobil... The ARM backend has bitrot now so no longer works.
- undecidabot 8y agoFor those who want a taste of Factor, check: http://re-factor.blogspot.com/ http://re-factor.blogspot.com/ (You might want to scroll down past the release notes.)
- pome 8y agoAnd if anyone is interested in knowing more about Factor, this tutorial is pretty good, from basics to the web development using Furnace (Factor Web Framework) - https://andreaferretti.github.io/factor-tutorial/ https://andreaferretti.github.io/factor-tutorial/ :-)
- platz 8y agoWhat is the value prop of a stack-based language?
- cultus 8y agoEverything is based on composition, which makes it easy to build computations up like building blocks. Stacks are also efficient. The JVM bytecode is actually a stack language, for example. There's a newer one called Kitten that is statically typed and uses term rewriting to allow for more normal syntax when you want. It's pretty cool. Too bad none of these languages will ever take off.
- bgongfu 8y agoAnd since composition is seamless, and they're relatively trivial to implement; they make great glue/DSL/process description languages. Take off as in replace C++ or Java, probably not. I see them more as a complement to existing languages, a more convenient way to glue the pieces together. Even wrote my own [0] to see how far it's possible to push that idea in C. [0] https://github.com/basic-gongfu/cixl https://github.com/basic-gongfu/cixl
- rurban 8y agoInteresting. But does cixl really do refcounting on stack values? It should only be done on aggregates or objects reaching out into the heap, not on int or float primitives on the stack.
- bgongfu 8y agoPrimitive types such as booleans, int, floats, times etc. are passed by value. Reference counting is only used for heap allocated values and types that themselves reference values, like pairs and tables. https://github.com/basic-gongfu/cixl/blob/master/src/cixl/box.h https://github.com/basic-gongfu/cixl/blob/master/src/cixl/bo...
- Someone 8y ago
- 3rdAccount 8y agoI didn't think Slava was involved anymore. It certainly seems like a neat language, but I could never find enough beginner material to make any headway (not sure if anything has changed in the past few years). There is a Google tech talk where Slava talks about Factor @ Google.
- dom96 8y agoSlava is working on Swift at Apple now AFAIK
- 3rdAccount 8y agoThanks Dom. I recalled he was working at either Apple or Google, but couldn't remember which.
- doublec 8y agoI have a PDF of some of my Factor related blog posts here if interested: https://bluishcoder.co.nz/2008/04/04/collection-of-factor-articles-in-pdf.html https://bluishcoder.co.nz/2008/04/04/collection-of-factor-ar... It gives an overview of using some Factor libraries and features. Some have bitrot by now but many still work.