6 ms·
Factor: A Practical Stack Language
- dharmatech 4y agoChris Double's posts on Factor: https://bluishcoder.co.nz/tags/factor/index.html https://bluishcoder.co.nz/tags/factor/index.html
- bjoli 4y agoBe careful. Factor is a gateway to lower level stack based languages. I saw Zed Shaw do a presentation using factor and decided to spend a weekend playing with it. It was the start of a two year journey that ended with me writing forth for microcontrollers. That was time I should have studied but was somehow always sidelined by other things.
- butterisgood 4y agoI too have been "nerd sniped" by factor before... it's quite cool.
- mncharity 4y agoImagine being able to say "I feel concatenative this afternoon" and easily find active interesting efforts to contribute to for a few hours, solo or pair or team. Dreams for the newborn github included support for let's-meetup-and-hack realtime dynamic community formation, but I've not yet seen the like. I enjoyed Factor. Fixed stack-effect seemed a nice trade of flexibility for less oops. I'd love to see someone start concatenative, but with a replace-the-world focus. So move quickly up-scale to single and multiple dispatch PICs, tabled WAM, clone V8 internals, link Z3, etc, etc. "If you're not able to implement other languages in bulk, and better than they are, you're still wedged". Sort of a LispMachine for an age where a much broader-than-cons foundation is possible/appropriate.
- adastra22 4y agoOh the flip side, if you told that story in an interview I'd hire you on the spot.
- bjoli 4y agoCurrently you probably wouldn't. I am a classical musician. CS or EE is however my backup if I get injured or for some reason lose my job.
- adastra22 4y agoI wouldn't hire you for a leadership role then, but it wouldn't stop me from hiring you. It is damn hard to find someone capable to delve deep into technology like that without hand-holding, and walk away with a working command of such obscure knowledge. People like that can be taught and trained to work on whatever project I am working on. So with a gap working as a classical musician it might mean starting effectively as a (paid) intern, but it would still get your foot in the door. I don't claim to be representative of all, or even most hiring managers though.
- crest 4y agoHave you found #forth-hardware-projects and #mecrisp?
- fmakunbound 4y agoThere’s also a pretty active Forth channel on Discord
- bjoli 4y agoThis is almost 15 years ago, and I didn't have a reliable internet connection, so sadly no. There was two of us in a small computer group in Germany trying to figure things out, mostly.
- jasone 4y agoHah, you could have done worse. The double-dose introduction to stack-based programming via HP calculators and Adobe PostScript in the 90s led me to spend on the order of 3000 hours developing Onyx (https://github.com/canonware/onyx https://github.com/canonware/onyx), which started off as a PostScript clone minus graphics, and ended up a thing of its own. On the bright side, I learned a tremendous amount about lexing, interpreters, exceptions, tail-call optimization, data structures, garbage collection, etc., which opened up lots of possibilities in later projects. With the benefit of hard experience I would never recommend using a stack-based language for a large project, but as a learning tool it has some nice qualities.
- bjoli 4y agoFun stuff! I find that the more I find out about PL research and what I myself like in programming, the more I feel constrained in many languages. I find that most of the bugs I write (which are many) are errors in dealing with mutable state. There is always one stupid little detail that leads to bad state. This has led me to dislike the programming language I write the most (probably python, despite really only wanting to write scheme) because it is mutation first. I was also sad to discover that I couldn't write self-recursive procedures in rust because they are never guaranteed to be actually recursive. Did you get anything like that from your work with onyx? (And yes, I believe I have actually has a look at onyx about 10 years ago, back when trying to write poatscript).
- junon 4y agoThis is how you get hired at weird (good way) places you never forget, though.
- bmitc 4y agoDo you have any links to things you have done or any interesting resources for Forth on microcontrollers?
- belfalas 4y ago> I saw Zed Shaw do a presentation using factor and decided to spend a weekend playing with it. I saw the same presentation back then and also spent a weekend with factor. It was a really valuable experience. The language was so different from anything I had previously used that I had to learn a new way of thinking. That was a great thing to go through. Slava Pestov (the creator of factor) did a presentation on the language at Google back in the 2000s. A highlight from the talk was him explaining that there was a function 'boa' that you could call to construct an object 'by order of arguments'. He called it "a boa constructor." :)
- dang 4y agoRelated (others?): Factor: A Practical Stack Languge - https://news.ycombinator.com/item?id=22053857 https://news.ycombinator.com/item?id=22053857 - Jan 2020 (21 comments) Factor: An impressive stack-based language environment - https://news.ycombinator.com/item?id=17726634 https://news.ycombinator.com/item?id=17726634 - Aug 2018 (34 comments) A Panoramic Tour of Factor (2015) - https://news.ycombinator.com/item?id=11377847 https://news.ycombinator.com/item?id=11377847 - March 2016 (6 comments) Factor – A Practical Stack Language - https://news.ycombinator.com/item?id=10141410 https://news.ycombinator.com/item?id=10141410 - Aug 2015 (7 comments) Factor – A practical stack language - https://news.ycombinator.com/item?id=9008472 https://news.ycombinator.com/item?id=9008472 - Feb 2015 (41 comments) A panoramic tour of Factor - https://news.ycombinator.com/item?id=8750720 https://news.ycombinator.com/item?id=8750720 - Dec 2014 (10 comments) Factor 0.97 now available - https://news.ycombinator.com/item?id=8548832 https://news.ycombinator.com/item?id=8548832 - Nov 2014 (18 comments) Web scraping with Factor - https://news.ycombinator.com/item?id=7628055 https://news.ycombinator.com/item?id=7628055 - April 2014 (24 comments) Factor's Visual REPL - https://news.ycombinator.com/item?id=1673792 https://news.ycombinator.com/item?id=1673792 - Sept 2010 (8 comments) Factor programming language (modern Forth) - https://news.ycombinator.com/item?id=1623697 https://news.ycombinator.com/item?id=1623697 - Aug 2010 (19 comments) Factor: Comparing Factor's performance against V8, LuaJIT and SBCL - https://news.ycombinator.com/item?id=1388540 https://news.ycombinator.com/item?id=1388540 - May 2010 (2 comments) Replacing GNU assembler with Factor code - https://news.ycombinator.com/item?id=1076658 https://news.ycombinator.com/item?id=1076658 - Jan 2010 (5 comments) Improved write barriers in Factor's garbage collector - https://news.ycombinator.com/item?id=884704 https://news.ycombinator.com/item?id=884704 - Oct 2009 (2 comments) A survey of domain-specific languages in Factor - https://news.ycombinator.com/item?id=854757 https://news.ycombinator.com/item?id=854757 - Oct 2009 (1 comment) Performance in Factor, Java, and Clojure - https://news.ycombinator.com/item?id=797378 https://news.ycombinator.com/item?id=797378 - Sept 2009 (16 comments) Factor programming language - https://news.ycombinator.com/item?id=782531 https://news.ycombinator.com/item?id=782531 - Aug 2009 (5 comments) Joy in Factor - https://news.ycombinator.com/item?id=772603 https://news.ycombinator.com/item?id=772603 - Aug 2009 (13 comments) Factor compiler improvements - https://news.ycombinator.com/item?id=738124 https://news.ycombinator.com/item?id=738124 - Aug 2009 (1 comment) Factor's implementation of polymorphic inline caching - https://news.ycombinator.com/item?id=629357 https://news.ycombinator.com/item?id=629357 - May 2009 (9 comments) Factor VM ported to C++ - https://news.ycombinator.com/item?id=600668 https://news.ycombinator.com/item?id=600668 - May 2009 (10 comments) Proof-of-concept Smalltalk implemented using Factor as a host VM - https://news.ycombinator.com/item?id=541836 https://news.ycombinator.com/item?id=541836 - April 2009 (3 comments) Factor: A practical stack language - https://news.ycombinator.com/item?id=279356 https://news.ycombinator.com/item?id=279356 - Aug 2008 (1 comment) Factor 0.88 released - https://news.ycombinator.com/item?id=1664 https://news.ycombinator.com/item?id=1664 - March 2007 (2 comments)
- mncharity 4y agoIn case anyone else was curious, Slava Pestov is now at Apple working on Swift. Top of his twitter[1] is a WWDC22 talk "Design protocol interfaces in Swift"[2] (but video seems 1x-only - I don't see a copy on yt - there's a transcript). [1] https://twitter.com/slava_pestov https://twitter.com/slava_pestov [2] https://developer.apple.com/videos/play/wwdc2022/110353/ https://developer.apple.com/videos/play/wwdc2022/110353/
- mupra 4y agoHe is also the person behind the JEdit editor (or at least one of the main guys).
- dmix 4y agoThose examples look really weird and cool. This web app is using XML for it's views: https://github.com/factor/factor/blob/master/extra/webapps/wiki/wiki-common.xml https://github.com/factor/factor/blob/master/extra/webapps/w...
- dharmatech 4y agoYou can read HN in the Factor listener: https://bluishcoder.co.nz/2020/04/18/fun-factor-libraries.html https://bluishcoder.co.nz/2020/04/18/fun-factor-libraries.ht...
- Avshalom 4y agoI used to play around with Factor in 05-10ish. Had all of a semester of C and a few physics labs worth of Matlab under my belt so I never actually managed anything interesting in it but god damned if it hasn't ruined me for every other language.
- pyrolistical 4y agoMade me realize webassembly is almost a concatenative language
- UncleEntity 4y agoOne of the text forms is totally stack based while the second is quite lispy. And, according to the official grammar, you can mix the two forms willy-nilly — aside from the function header which needs to be in the lisp form IIRC.
- unsafecast 4y agoThe 'lispy' one is actually just a stack language written using sexps.
- juunpp 4y agoDamn, that indeed looks interesting. Could someone give here a Factor vs Forth tl;dr? Forth appears to be tailored for embedded systems, but the velociraptor is growing quick on me.
- Jtsummers 4y agoFrom the FAQ [0]: > How is Factor different from Forth? > Forth is untyped, not garbage collected, and close to the machine. For flow control, Forth code tends to use immediate words. Variables and arrays tend to be global, and programs aren't usually written in a functional manner. Factor is very different from this. It is dynamically typed, offering a high degree of reflection. Unreferenced objects are garbage collected with a generational garbage collector. Factor code is a little bit more distant from the machine, though the C FFI allows using words like malloc and mmap. For flow control, Factor generally uses quotations, allowing flexible higher order functions; parsing words are used mostly for definitions and data literals. Variables are dynamically or statically scoped (see below), and arrays are just objects which don't need to be treated specially. [0] https://concatenative.org/wiki/view/Factor/FAQ/Why%3F https://concatenative.org/wiki/view/Factor/FAQ/Why%3F
- juunpp 4y agoAlso Forth appears to be heavily corporate. Except for GNU's Gforth compiler, tools appear to be commercial.
- shrubble 4y agoThere are many many free Forths, across almost all architectures. Dxforth, ciforth, FIG-Forths etc.
- unsafecast 4y agoThere's no one forth. A huge number of forth users end up writing their own forth, with different semantics, because it can be easier that way. Though you're right, forths are unusually commercial. Forth is old, and in some ways it stayed old. A lot of people that use it now have used it since the 80s, so they're quite used to paying for compilers. There's also the fact that forths are used in very niche places, and the companies that use them are happy to pay up. You'll find a very open community with really nice people though.
- danbmil99 4y agoAnother recovering FORTH addict here
- mckinney 4y agoHa! I implemented "concatenative" programming for Java as Binding [1] (or Unit) expressions, but had no idea. Seriously, never came across that term before this post. The idea with binding expressions is the type of expression A and the type of expression B implement "reactions" with one another in order to form a binding expression when they are lexically adjacent. 65 mph The type of `mph` defines a post reaction method with the type of `65` as an argument that results in type Rate. As I understand it this is concatenative, right? Another example: Money payment = 1.5M USD; There are tons of these. Concatenative programming in general feels like it should have a more prominent place in mainstream languages. Just my take. [1] https://github.com/manifold-systems/manifold/tree/master/manifold-deps-parent/manifold-ext#unit-expressions https://github.com/manifold-systems/manifold/tree/master/man...
- bmitc 4y agoIt is my understanding that the JVM itself uses a stack model at its core.
- opminion 4y agoIf you see units as multiplicative factors: 1.5 USD = 1.5 * USD 65 mph = 65 * mile / hour you can then use simple algebra to solve unit conversion and many other common deductive reasoning questions ("how many miles per gallon...?"), relying on the units to guide you to the solution. There's probably a name for this, and it is indeed built into the SI notation (km/h vs mph).
- chriswarbo 4y agoSounds like https://en.wikipedia.org/wiki/Dimensional_analysis https://en.wikipedia.org/wiki/Dimensional_analysis
- mckinney 4y agoThis is already implemented with manifold's unit expressions, but is made richer and more readable via concatenative features. For instance, '1.5 * USD' is not as readable as simply '1.5 USD'. However, unit expressions leverage operators for dimensional arithmetic: Force f = 5 kg * 9.807 m/s/s; // result: 49.035 Newtons Area space = (20ft + 2in) * (37ft + 7.5in); // result: 758 37/48 ft² All unit expressions internally store amounts as SI units, which enables interunit expressions. Length height = 6 ft + 4 cm; // mix SI and US units out.println(height.to(ft)); // display any unit You aren't limited to units. Generally, any concatenative sequence can be implemented. Like ranges: IntegerRange range = 1 to 5; Here the `to` identifier's type implements reactions to Number types to produce range types, which enables: for (int i: 1 to 5) { out.println(i); } See the manifold project's Unit and Science modules: Units: https://github.com/manifold-systems/manifold/tree/master/manifold-deps-parent/manifold-ext#unit-expressions https://github.com/manifold-systems/manifold/tree/master/man... Science: https://github.com/manifold-systems/manifold/tree/master/manifold-deps-parent/manifold-science https://github.com/manifold-systems/manifold/tree/master/man...
- hansvm 4y agoConcatenate languages are fun, but damn if that isn't an annoying UI. It's gated with some kind of captcha, and it made me go through 40+ rounds, with every few selected images resizing and shifting the captcha.
- gre 4y agoThere shouldn't be any captchas. Do you mean on the website, like Cloudflare captchas? Which country/vpn/whatever are coming from?
- hansvm 4y agoOn the website, like a Google captcha. I clicked through to see what the macro story was like and was hit with a captcha. USA, no VPN.
- hansvm 4y agoJust took a look on desktop. I'm just inadvertently being sent to edit links with empty content when looking at some of the language features, and edits are recaptcha protected.