nineties / amber Goto Github PK
View Code? Open in Web Editor NEWA Language for High-Level Programming with Self-Extension
Home Page: http://nineties.github.com/amber
License: Other
A Language for High-Level Programming with Self-Extension
Home Page: http://nineties.github.com/amber
License: Other
Change the internal representation of [a,b,c,...]
from a list to an array.
Enable use of OR-pattern.
f(Foo{x, } or Bar{, x}): x
f(\Foo{1, 2}) # => 1
f(\Bar{1, 2}) # => 2
found in commit: c14f05c
When the value of code_base is even amber fails to start up.
What is the best data type for the syntax [a,b,c,...]
?
[a,b,c,...]
is the most simple expression to represent a sequence. This means that the internal
representation for the sequence must be efficient for most common usages of sequences.
I am considering an improvement on the internal representation of arrays.
For the first time we create an array, allocate one continuous memory space for it.
| header | obj0 | obj1 | ... | obj n-1 |
When it is extended and its length becomes bigger than some threshold, allocate another chunk, change the array to dynamically allocated array and truncate area which is no longer required.
|header|length|capa|pointer| <-- truncate
|
+-->| obj0 | obj1 | ... | obj n-1 |
The truncation causes fragmentation of heap area, but Amber VM's Copying-GC will resolve it.
Implement predicate named "defined":
defined(f, a_1, ..., a_n) = true (iff `f' is defined for arguments a_1, ..., a_n)
Distinguish f(a,b,c)
, f[a,b,c]
and f{a,b,c}
from f (a,b,c)
, f[a,b,c]
and f {a,b,c}
.
We need nospace
option for defining syntaxes. See also #29.
When a function f
returns multiple values as a tuple, we can use pattern matching assignment to pick them up like
(a, b) = f(...)
I think it would be nicer if we can write it like:
a, b = f(...)
There are three possibilities.
Survey use case of parentheses-less tuple syntax in other languages like Python.
When there are no significant use of it besides multiple assignment, I think it is better
to choice 2.
See also #29.
Enable to assign a value to an interior parameter like:
f(Foo{x, Bar{y}}): {
x = 1
y = 2
}
Note: This assignment must not change given parameter.
e: \Foo{0, Bar{0}}
f(e)
puts(e) # => Foo{0, Bar{0}} (not Foo{1, Bar{2}})
Because Amber's arrays are heterogeneous, arrays can be used in place of tuples.
Currently a symbol "false" is treated as falsehood and every other value is treated as truth.
There should be other falsehoods?
Support one-line declaration of modules.
module A { ... }
branch: refactoring (032657d)
95% of calls of make_assembler() are in build_closure().
Since build_closure() always creates fixed-length (13bytes) bytecode, it is not necessary to use assembler.
a - b
is parsed as a(-b)
.
The second argument of Send
expression is not a variable but a name of method.
The function free_variables
trates it as a variable (at 705213b).
I decided to use [a,b,c,..]
for arrays (#34). Then, how about lists?
I use a list for a default data type for sequences in the internal implementation of Amber. But lists are not memory efficient (three words are required per one element).
Should Amber support the syntax of parentheses-less function call like Ruby?
I think it would be better to support to make new DSLs easier.
Now, I have one thing to think about tuples and lists.
When someone want to print out a tuple (a,b,c)
, he may write it as print (a, b, c)
.
But this is confusable with print(a, b, c)
, a function call with three arguments a
, b
and c
. Lists has the same problem.
In case of Ruby, there are no tuples and for arrays f[a,b,c]
and f [a,b,c]
have different meaning.
Are there any other problems with this syntax?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.