Tractatus Pico-Blaesicus
The title of this article is inspired by the famous (Tractatus Logico-Philosophicus). The Latin word "blaesus" means "lisping" :)Here we will try to give a thorough description of all pros and cons of the programming language PicoLisp.
The pros of PicoLisp
1. Picolisp is Simple
2. PicoLisp is Transparent
There is a 1:1 mapping between external and internal representationa. No compiler messing with the code
b. Symbols have a clear identity
- A symbol has a unique address
- Values are bound to symbols (stored in VAL)
- Unlike lexical binding, where variables are detached from symbols
- Each symbol has its value in a dedicated value field
- A Lisp-level function is just a list
- OOP/Inheritance: List of functions (methods) and symbols (classes)
- Closure-environments are explicit list structures
- Destructive and non-destructive list manipulations. No hype about "immutable data structures"
3. PicoLisp is Powerful
a. Powerful NOT in terms of processor performanceb. But powerful in terms of expressivity. Complicated things can be expressed easily
c. The use of FEXPRs
- A FEXPR is a function which does not evaluate its arguments. Decisions about evaluation are delegated to the function body
- Other languages must use macros for that
- Macros have several disadvantages compared to FEXPRs
- They are not first-class items, so they can't be applied, assigned or passed to other functions
- They are no longer available at runtime, so they can't be inspected, traced or debugged
- They are active only at compile time, so they cannot adjust dynamically to runtime situations
- On the lowest level, +all+ functions are FEXPRs in PicoLisp, or - to be correct - FSUBRs, the machine-code counterparts of FEXPRs)
- Compiler-based languages frown at FEXPRs
- They cannot be compiled well
- Because of their pure code/data equivalence
- Arguments (= data) are executed dynamically (= code)
- A compiler cannot handle this from lexical, static inspection
- NIL is universal
- It is an end-of-list marker
- It represents the empty list
- It represents the boolean value "false"
- It represents the absolute minimum
- It represents a string of length zero
- It represent the value "Not a Number"
- It is the root of all class hierarchies
- Single symbolic data type
- No special strings, variables and identifiers
- Single functional type
- No "special forms"
- Functions can be used in any context, as opposed to macros
- Calling native libraries with the native function
- Interfacing to Java objects -> Java Interoperability
g. Built-in database
h. Succinctness. Read Paul Graham: Succinctness is Power
4. PicoLisp is Efficient
a. Not especially efficient in execution speed, but still quite fast for an interpreter, but in terms of programmer's effort- Integrated database
- Web based application framework and HTTP server
- Low memory footprint
- Fast startup and execution
The cons of PicoLisp
1. Lisp syntax
People dislike "many parentheses"2. Interpreter-only
a. Slower in execution speed as compared to a native compiler ( but faster than some Lisps which compile to byte code)b. An interpreter has advantages over a compiled language
- True equivalence of code and data
- Faster startup and file loading
- Smaller memory footprint
- Size is more important than raw code execution speed
- Memory bandwidth is the bottleneck
- More cache hits
3. Omitted features
Floating-point numbers, but fixpoint numbers can be used instead4. Arrays
Array Abstinence5. Threads
a. Threads which share runtime heap are not possible in PicoLisp- They would overwrite each other's symbol bindings
- This is due to dynamic binding
- The current values of symbols are stored in the heap
- The saved values of symbols are stored on the stack
- Forking processes in PicoLisp is efficient
- The fork() system call copies only on demand
- Memory footprint is low usually
- Built-in interprocess-communication (Family IPC)
- Processes can be distributed across multiple machines
5. Flaws
PicoLisp may segfaulthttp://www.picolisp.com/wiki/?prosandcons
20feb23 | abu |