Content deleted Content added
→Description: The word 'datastructure' was changed to 'data structure' |
m Bot: http → https |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 7:
|year = 2003
|developer = Slava Pestov
|latest_release_version = 0.
|latest_release_date = {{start date|
|typing = [[strong typing|strong]], [[dynamic typing|dynamic]]
|influenced_by = [[Joy (programming language)|Joy]], [[Forth (programming language)|Forth]], [[Lisp (programming language)|Lisp]], [[Self (programming language)|Self]]
Line 20:
==History==
Slava Pestov created Factor in 2003 as a [[scripting language]] for a [[video game]].<ref>{{cite web | url =
The language has changed significantly over time. Originally, Factor programs centered on manipulating Java objects with Java's [[reflection (computer science)|reflection]] capabilities. From the beginning, the design philosophy has been to modify the language to suit programs written in it. As the Factor implementation and standard libraries grew more detailed, the need for certain language features became clear, and they were added. JFactor did not have an [[object system]] where the programmer could define their own [[class (computer science)|class]]es, and early versions of native Factor were the same; the language was similar to [[Scheme (programming language)|Scheme]] in this way. Today, the object system is a central part of Factor. Other important language features such as [[tuple]] classes, combinator inlining, [[macro (computer science)|macro]]s, user-defined [[parsing]] words and the modern vocabulary system were only added in a piecemeal fashion as their utility became clear.
Line 26:
The [[foreign function interface]] was present from very early versions to Factor, and an analogous system existed in JFactor. This was chosen over creating a plugin to the [[C (programming language)|C]] part of the implementation for each external [[library (computing)|library]] that Factor should communicate with, and has the benefit of being more [[declarative programming|declarative]], faster to compile and easier to write.
The Java implementation initially consisted of just an [[interpreter (computing)|interpreter]], but a compiler to [[Java bytecode]] was later added. This compiler only worked on certain procedures. The Java version of Factor was replaced by a version written in C and Factor. Initially, this consisted of just an interpreter, but the interpreter was replaced by two compilers, used in different situations. Over time, the Factor implementation has grown significantly faster.<ref>{{cite web | url =
==Description==
Line 37:
The [[factorial|factorial function]] <math>n!</math> can be implemented in Factor in the following way:
<syntaxhighlight lang="factor">
: factorial ( n -- n! ) dup 1 > [ [1
</syntaxhighlight>
Line 57:
==Implementation and libraries==
Factor includes a large standard library, written entirely in the language. These include
* A cross-platform GUI toolkit, built on top of [[OpenGL]] and various windowing systems, used for the development environment.<ref>{{cite web | url =
* Bindings to several database libraries, including [[PostgreSQL]] and [[SQLite]].<ref>{{cite web | url =
* An [[HTTP]] server and client, with the Furnace web framework.<ref>{{cite web | url =
* Efficient homogeneous arrays of integers, floats and C structs.<ref>{{cite web | url =
* A library implementing regular expressions, generating machine code to do the matching.<ref>{{cite web | url =
A [[foreign function interface]] is built into Factor, allowing for communication with [[C (programming language)|C]], [[Objective-C]] and [[Fortran]] programs. There is also support for executing and communicating with shaders written in [[GLSL]].<ref name="dls"/><ref>{{cite web | first = Slava | last = Pestov | url =
Factor is implemented in Factor and [[C++]]. It was originally bootstrapped from an earlier Java implementation. Today, the parser and the optimizing compiler are written in the language. Certain basic parts of the language are implemented in C++ such as the garbage collector and certain primitives.
Factor uses an [[system image|image]]-based model, analogous to many [[Smalltalk]] implementations, where compiled code and data are stored in an image.<ref>{{cite web | first = Slava | last = Pestov | url =
The Factor compiler implements many advanced optimizations and has been used as a target for research in new optimization techniques.<ref name="dls"/><ref>{{cite web|first=Daniel |last=Ehrenberg |title=Closure elimination as constant propagation |url=http://factorcode.org/littledan/abstract.pdf |year=2010 |url-status=dead |archive-url=https://web.archive.org/web/20110726044425/http://factorcode.org/littledan/abstract.pdf |archive-date=2011-07-26 }}</ref>
|