Factor: an extensible interactive language

Factor: an extensible interactive language, Google Tech Talk by Slava Pestov.

Factor is a general-purpose programming language which has been in development for a little over five years and is influenced by Forth, Lisp, and Smalltalk. Factor takes the best ideas from Forth -- simplicity, succinct code, emphasis on interactive testing, meta-programming -- and brings modern high-level language features such as garbage collection, object orientation, and functional programming familiar to users of languages such as Python and JavaScript. Recognizing that no programming language is an island, Factor is portable, ships with a full-featured standard library, deploys stand-alone binaries, and interoperates with C and Objective-C.

In this talk, I will give the rationale for Factor's creation, present an overview of the language, and show how Factor can be used to solve real-world problems with a minimum of fuss. At the same time, I will emphasize Factor's extensible syntax, meta-programming and reflection capabilities, and show that these features, which are unheard of in the world of mainstream programming languages, make programs easier to write, more robust, and fun.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Concerning naming conventions...

Maybe someone can answer why they push the idea of using cryptic naming conventions?

full? instead of isFull
?full instead of ifFull (or would it be "fullIf" ?)

Yes, I know it's optional (at least from what I read...) but why make the barrier to entry so large? (from a readability standpoint) It's not like the language is trying to be a cross language PL; they use English words for their "Vocabulary."

And for the record. I also have a problem with C and pointer representation * and & instead of "pointer" and/or "addressOf" It simply makes the program harder to read through if you are trying to decrypt what the programmer wants to do with the symbols instead of just using simple words.

I don't know. Maybe I'm out of line here.

I'm not sure I'd call

I'm not sure I'd call "full?" cryptic at this point—it's become a pretty popular convention. Still, it has always driven me nuts that an ostensible question, "is it full", could return true or false. I'm a fan of "fullp", which is more cryptic but at least is an assertion which can be true or false. OTOH, if naming conventions for predicates are a language's biggest flaw, the designer ought to be feeling pretty good.

And for the record, I think the same thing about C. Especially about how * plays double duty.

What is the "p" in "fullp"?

What is the "p" in "fullp"? Predicate? And for the record, I still haven't gotten past the naming conventions in my learning process. I was distracted. ;)

Scheme conventions

Using ? at the end of predicates is the standard convention used by Scheme (null?, prime?, etc...). The reason most other languages don't use this convention is that most are limited to alphanumeric and underline in their naming conventions. Anyhow, I haven't seen any confusion in Scheme over this naming convention.

Can't say I like the ?full convention for "if full", but such idioms have a tendency to become natural once you get into the culture of a language. Which is actually the bigger issue with learning any language - you have to accept quite a few idioms that come with the community for any particular PL.

Yes, it's for predicate. It

Yes, it's for predicate. It comes from the non-Scheme side of the Lisp family. I like it because predicates are labeled, but not with a non-pronouncing character. Plus the whole "Is it full?" "True." "Uhhh....".

Bah to Hungarian notation...

...and other places where the type of a term is arbitrarily "encoded" somehow in its name. By "arbitrary", I mean in situations where the type (or representation of a type) isn't manifest from the functional description. I know I'm splitting hairs here...

It's especially obnoxious when you're dealing with a type that the compiler/language in question can represent. (It's a different matter, I suppose, when dealing with domain types which are narrower than what the type system can handle--Hungarian notation here can better express intent--but still kinda kludgy).

If you want to specify the type of a term, it is best to do so formally.



Naming conventions are just that - conventions

As someone who done a small amount of programming in Forth, conventions that use @ and ! and ? for load, store and query as a common idiom ensures that understanding of new code becomes that much easier. Factor draws from a Forth base as well as Scheme and the conventions in place are there for comprehension.

I find Java and C# and others of that ilk to be more difficult to pick up than something like Factor which really only has two basic modes - parsing words which typically end in : or RPN words which affect and use the stack.

To state the obvious, all programming languages have idiomatic ways of expressing ideas and once the idioms are understood, then well written programs are that much easier to understand.

In the case of Factor, the use of non-alphabetic characters in word names actually makes reading the code that much easier to comprehend. Some idioms that have developed in Factor are strange, I have problems with Fry but even there it becomes a matter of understanding the idiom (semantics) being expressed.

In your comments about C, I recall a comment being made about a snippet of code that uses multiple *'s and trying to determine the actual meaning of this snippet. Many languages have anomalous syntactic structures that give rise to misunderstanding on the part of those trying to read the code, witness all the obfuscated programming contests that abound. Constructive consistency is not a common attribute of mankind.

these are conventions from Forth

full? and ?full are standard Forth conventions dating back to the 1970s.