In the paper

4.2 Deca versus the research language BitC
BitC[58, 59] was a recent systems-programming language designed from the 
opposite perspec-
tive from Cyclone. Rather than bring C up to high-level power, the BitC 
researchers aimed to
bring the high-level power of Lisp, Haskell, and Standard ML down to systems 
programming.
The BitC research team was also building a complete, formalized semantics 
for their language,
and produced a compiler that transformed BitC code down into C.
BitC featured mutability and full type inference[60] in a functional 
language, along with
other functional features such as pattern-matching, closures, existential 
objects, and first-class
mutability. It lacked subtyping, objects, or dynamic dispatch of any kind, 
but supplied Haskell-
style type classes instead, and little complaint on the matter has been 
heard. BitC used a Lisp
s-expression syntax until around 2008, when they switched to a 
Python/Haskell-like syntax more
resembling the family of statically-typed functional languages. 
Unfortunately, BitC seems to
have required occasional boxing of data and a garbage collector. Work on 
BitC also seems to
have been suspended in 2009 when Jonathan Shapiro went to work on the Midori 
project[61],
but in 2010 he announced that he would return to working on BitC[62].
In contrast to BitC, Deca does not supply first-class mutability, preferring 
uncontrolled perva-
sive mutability for easier systems programming. I have also preferred, in 
Deca, a “curly-braces”
imperative syntax with more resemblance to Scala and Object Pascal than to 
Scheme or ML.
These are almost purely aesthetic choices, but these purely aesthetic 
choices do seem to have
kept many programmers away from languages like Scheme and ML for a very long 
time. In a
more important and direct contrast to BitC, Deca features only unboxed data 
and does not require
a garbage collector. Deca also supplies an object system built on top of its 
open variants, with
subtyping and multiple dynamic dispatch such as are found in more 
conventional languages.
BitC brought advanced functional features most of the way down to the 
systems-programming
level. Deca adds in a little from the object-oriented world, makes things 
prettier and takes them
all the way down to the full systems level.


Some deca code ...

u n s a f e m o d u l e c o n s t r u c t

i m p o r t m a l l o c

f u n c t i o n new<a > ( o b j e c t : a , d e s t r u c t o r : a @ > U n 
i t ) : @a {
l e t ( r e s u l t : = c a s t <@[ a , d e s t r u c t o r : a @ > U n i 
t ] > ( m a l l o c : : m a l l o c
( s i z e o f ( [ a , a @ > U n i t ] ) ) ) ) {
r e s u l t ^ . [ 0 ] : = a ;
r e s u l t ^ . d e s t r u c t o r : = d e s t r u c t o r ;
@ r e s u l t ^ . [ 0 ] ;
}
}


f u n c t i o n d e l e t e <a > ( o b j e c t : @a) : U n i t {
l e t ( t u p l e : = c a s t <@[ a , d e s t r u c t o r : a @ > U n i t ] 
 > ( o b j e c t ) ) {
( t u p l e ^ . d e s t r u c t o r ) ( t u p l e ^ . [ 0 ] ) ;
m a l l o c : : f r e e ( c a s t <@byte > ( t u p l e ) )
}
}

e n d


Ben
-----Original Message----- 
From: Sandro Magi
Sent: Monday, January 02, 2012 11:28 AM
To: Discussions about the BitC language
Subject: [bitc-dev] Deca: a safe systems programming language

It provides full control over memory layout, uses a region-and-effect
system to prevent memory hazards like escaping pointers, and supports
various other useful features like subtyping:

http://lambda-the-ultimate.org/deca

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev 

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to