start on a README
This commit is contained in:
commit
90bf8a4eb8
56
README.md
Normal file
56
README.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# Embedded Language Ideas
|
||||||
|
|
||||||
|
I would like a scripting language to be able to easily embed in a host application with the following features:
|
||||||
|
|
||||||
|
* Sandboxed for secure execution of untrusted code
|
||||||
|
|
||||||
|
For example, the language should not automatically make available functionality that allows scripts to arbitrarily read or write files in the host filesystem, or spawn processes, or establish network connections.
|
||||||
|
|
||||||
|
* Dynamically typed
|
||||||
|
|
||||||
|
* Multi-paradigm
|
||||||
|
|
||||||
|
The language should support imperative, object-oriented, and some functional aspects.
|
||||||
|
|
||||||
|
* Supports nil, Boolean, Integer, Float, String, Array, Hash, and Class types
|
||||||
|
|
||||||
|
* Supports closures
|
||||||
|
|
||||||
|
# Features of Other Languages to Use or Avoid
|
||||||
|
|
||||||
|
* Lua
|
||||||
|
* Good:
|
||||||
|
* Great C API documentation
|
||||||
|
* Not so good:
|
||||||
|
* 1-based array indexing
|
||||||
|
* The '#' operator not handling `nil` values within an array
|
||||||
|
|
||||||
|
* Javascript
|
||||||
|
* Not so good:
|
||||||
|
* Having both a `null` and `undefined` value is overcomplicated.
|
||||||
|
* Classes/types are not types, so `typeof` returns a string.
|
||||||
|
|
||||||
|
* Ruby
|
||||||
|
* Good:
|
||||||
|
* One `nil` value
|
||||||
|
* Clear definition of which objects are "falsey"
|
||||||
|
* Functional blocks
|
||||||
|
|
||||||
|
# Syntax Ideas
|
||||||
|
|
||||||
|
## Declare a variable
|
||||||
|
|
||||||
|
var foo := 42;
|
||||||
|
|
||||||
|
## Declare a function
|
||||||
|
|
||||||
|
function foo(a, b)
|
||||||
|
{
|
||||||
|
a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
Similar to Ruby, the result of the last expression is returned from a function, so an explicit `return` is not needed.
|
||||||
|
|
||||||
|
## Anonymous Function
|
||||||
|
|
||||||
|
var f = function(x) { x * x; }
|
Loading…
x
Reference in New Issue
Block a user