const, ref, var and default argument passing

42 views
Skip to first unread message

Rodéric Vicaire

unread,
May 13, 2013, 12:36:03 PM5/13/13
to clay-l...@googlegroups.com
Anyone has any clue about the amount of work it would take to change argument passing to const reference and to add a const keyword for constants (as opposed to variables) ?

Small examples:

const x = 1;//immutable
var y = 2;//mutable

foo( x: Int )//conceptually const reference to x, expected copy optimisation
foo( x: SomeRecord )//const reference
foo( x: ref SomeRecord )//reference


I've been using C++ again, and when it comes to tools and features (atomics, alignment, SSE intrinsics...) it's really good, unfortunately the language is still a pain to use and C++11 just made it worse (more complicated, even though it offers some optimizations), in short, I still like Clay better, but I'm missing a few features to make it more reliable.
(It's all too easy to mutate something by accident w/o the help of the compiler, we all change code and make mistakes.)

I'm not against doing changes myself, but I have no clue how long it would take to get used to the code base and implement the features, and I have a limited amount of free time available :(


   Rodéric.

Joe Groff

unread,
May 16, 2013, 11:14:10 AM5/16/13
to Clay Programming Language
 If you've worked with compilers and LLVM before, the Clay codebase should be fairly straightforward. The lexer, parser, analyzer (which does type-checking), evaluator (which evaluates code at compile-time), and codegen (which generates runtime LLVM code) are fairly well-separated, thanks to the work of Jeremy, Stepan, and Dmitry to improve the modularity there. You could perhaps add "const" as a modifier like "ref" and "rvalue" are now, which would require changes to the parser (to add the syntax) and the analyzer (to add the type-checking support).

-Joe
Reply all
Reply to author
Forward
0 new messages