caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Looking for collaborators on a hobby project
@ 2004-05-26 20:21 Christian Szegedy
  2004-05-26 21:36 ` Brandon J. Van Every
  2004-05-28  9:17 ` Richard Zidlicky
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Szegedy @ 2004-05-26 20:21 UTC (permalink / raw)
  To: caml-list

I am looking for collaborators for the following project:

I am considering to create a Ruby-like language in Ocaml.

The main difference would be that it would be compiled
while assuring type safety.

It would be both interpreted (first pass), then a selected
subset of methods are mapped to Ocaml classes and
they get compiled.  It would be completely reflexive,
so the first pass would be able to modify the syntax tree
in any possible way.

So, the language would basically operate on itself as
a preprocessor (without type checks), then the second
phase would be done with exact type checking.

The Ruby (I don't plan to implement the whole language
at first, just the most important part of it.) classes
are mapped to Ocaml classes. The implementation
would only use a small part of Ocamls features.

Anyway, you would be able to program without writing
supplying ANY type information, just like in a scripting
language, but the compiler would detect
all possible type problems. Of course, that means that
every single data (integers,floats, etc.) are wrapped
by Ocaml classes, which would effect the run-time
compared to native Ocaml code considerable. However,
according to my preliminary test, they it would be still much
faster then a Ruby (or Python) code. The main advantage
of the approach is the additional safety of type checking.

The advantage over OCaml would be: easier to learn for
beginners. Full scale polymorphism and overloading.
Of course, you can achieve the same effect right now,
but it would simplify things quite a bit.

The front-end and the back-end would make heavy use
of CamlP4.

I would start with actual coding if I find someone somone
seriously interested.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [Caml-list] Looking for collaborators on a hobby project
  2004-05-26 20:21 [Caml-list] Looking for collaborators on a hobby project Christian Szegedy
@ 2004-05-26 21:36 ` Brandon J. Van Every
  2004-05-26 21:37   ` Richard Jones
  2004-05-28  9:17 ` Richard Zidlicky
  1 sibling, 1 reply; 7+ messages in thread
From: Brandon J. Van Every @ 2004-05-26 21:36 UTC (permalink / raw)
  To: caml

Christian Szegedy wrote:
>
> [subject: a 'hobby' project]
>
> The advantage over OCaml would be: easier to learn for
> beginners.

A strategic question for you: how do you hope to address the needs of
beginners if you're only putting a hobbyist level of effort into your
project?  I doubt you'll ever get anything done that actual beginners
will benefit from.  It sounds like a theoretical or exploratory
exercise.  It may be valuable to yourself or someone else, but not to
beginners.

Beginners are probably better served by Ruby plain and simple.  Why do
beginners care about type safety or performance?  For pedagogical
purposes, why do they want to work with something other than 'the
standard' version of Ruby?  They'd have an entire community of people to
answer questions and abundant assurance that everything works.
Meanwhile, you are only one guy.


Cheers,                     www.indiegamedesign.com
Brandon Van Every           Seattle, WA

"The pioneer is the one with the arrows in his back."
                          - anonymous entrepreneur

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.691 / Virus Database: 452 - Release Date: 5/26/2004

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Looking for collaborators on a hobby project
  2004-05-26 21:36 ` Brandon J. Van Every
@ 2004-05-26 21:37   ` Richard Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Jones @ 2004-05-26 21:37 UTC (permalink / raw)
  Cc: caml

I think it sounds like an interesting project, although a large amount
of work.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Looking for collaborators on a hobby project
  2004-05-26 20:21 [Caml-list] Looking for collaborators on a hobby project Christian Szegedy
  2004-05-26 21:36 ` Brandon J. Van Every
@ 2004-05-28  9:17 ` Richard Zidlicky
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Zidlicky @ 2004-05-28  9:17 UTC (permalink / raw)
  To: Christian Szegedy; +Cc: caml-list

On Wed, May 26, 2004 at 10:21:33PM +0200, Christian Szegedy wrote:
> I am looking for collaborators for the following project:
> 
> I am considering to create a Ruby-like language in Ocaml.
> 
> The main difference would be that it would be compiled
> while assuring type safety.

if you could create something as easy to learn, with the type
safeness and speed of ocaml that would be really great, not
only for beginners.

Ruby is much more object oriented while Ocaml strength
is the functional sort of programming. I wonder how
much of the speed advantage would be retained if you
turn everything (like numbers) into objects.

> It would be both interpreted (first pass), then a selected
> subset of methods are mapped to Ocaml classes and
> they get compiled.  It would be completely reflexive,
> so the first pass would be able to modify the syntax tree
> in any possible way.

> So, the language would basically operate on itself as
> a preprocessor (without type checks), then the second
> phase would be done with exact type checking.

not sure how much benefit this would be for the beginner..

> The Ruby (I don't plan to implement the whole language
> at first, just the most important part of it.) classes
> are mapped to Ocaml classes. The implementation
> would only use a small part of Ocamls features.
> 
> Anyway, you would be able to program without writing
> supplying ANY type information, just like in a scripting
> language, but the compiler would detect
> all possible type problems. 

iirc there also used to be something like "static" Ruby,
allowing to declare types to get more type safety.
It might be worth to include some possibility to do
so becuase otherwise some of the type safety might
be eroded by polymorphism. Eg pretty much every variable
in Ruby would turn into the object or nil polymorphism
whereas catching the nils in unexpected places was
typically the biggest issue I had with my Ruby proggies.

> Of course, that means that
> every single data (integers,floats, etc.) are wrapped
> by Ocaml classes, which would effect the run-time
> compared to native Ocaml code considerable. However,
> according to my preliminary test, they it would be still much
> faster then a Ruby (or Python) code. The main advantage
> of the approach is the additional safety of type checking.

do you want to support the similar type of bignum arithmetic
as Ruby? 

> The advantage over OCaml would be: easier to learn for
> beginners. Full scale polymorphism and overloading.
> Of course, you can achieve the same effect right now,
> but it would simplify things quite a bit.

this looks like a very interesting project to me.

Richard

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Looking for collaborators on a hobby project
  2004-05-27 22:09 ` skaller
@ 2004-05-27 23:00   ` Christian Szegedy
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Szegedy @ 2004-05-27 23:00 UTC (permalink / raw)
  To: caml-list

Dear Skaller!

I was not aware that you are behind the Felix project.
I really admire your achievments.

Ruby's classes are quite dynamic. There is a great deal of
reflexivity and onw can do a lot of metaprogramming and
nasty tricks like e.g. eval.

I don't plan my language to cope with all Ruby
finesses.  The programmer shoud use the interpreted pass
to do all the dirty hacks, the compiled functions would
would have a much more restricted repertoire.
E.g., I would not allow the user to do evals
in the type-checked part of the code. (Or,
alternatively the eval would be interpreted, but
for the first attempts, I would simply forbid it
together with other nasty features.)

I would not like to do any flow analysis. The main reason
 to use compilation is not performance, but type-safeness.
Today's computers are suitably efficient for most tasks. It's the
programmer's efficiency that should be improved.
(However, performance is still greatly improved over
interpreted Ruby or Python by the described transformations)
It is all mainly about reducing  programming and debugging
efforts.

I can program faster in Ruby for some tasks. This is mainly
because of the richer and more consistent syntax of Ruby and
its excellent and well designed class library. However as
a project grows, static typing in Ocaml saves me a lot of
debugging time. I would like combine these two different
advantages. Of course, performance should be improved when
possible.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Looking for collaborators on a hobby project
  2004-05-27 21:11 Christian Szegedy
@ 2004-05-27 22:09 ` skaller
  2004-05-27 23:00   ` Christian Szegedy
  0 siblings, 1 reply; 7+ messages in thread
From: skaller @ 2004-05-27 22:09 UTC (permalink / raw)
  To: Christian Szegedy; +Cc: caml-list

On Fri, 2004-05-28 at 07:11, Christian Szegedy wrote:
> Dear Skaller!
> 
> Is the Vyper project public?
> 
> I could not find any version of Vyper on the net. :(

It used to be on Sourceforge, but it's gone now
and I don't have a copy myself. What it did
was interpret the AST directly.

> You have written, that the analyis of the type information
> turned out be difficult. I can believe this. :)

For Python. Functions like 'eval' really make it
hard. Python has deprecated 'eval(str)' now: you're
supposed to use 'eval(str, dict)' so the dict
captures the dynamic variables instead of the current
scope. locals() hasn't work for ages due to compiled
function locals (special fast fetch bytecode).

But it is still very hard: Python class and objects are
also both dynamically extensible.

> Suppose, we have the following Ruby class:

I've never seen a Ruby program before. I have no idea
how dynamic it is..?

> After that, OCaml would take care of all the typing stuff...

Yes, but it won't help you optimise integer addition:
you'll have to do some special checks yourself,
and modify the generated Ocaml so it knows when
something is an integer.

> Of course using the myref class comes with a performance penalty also.
> This can be eliminated if one does not allow nil at all: that is all
> instance variables must have valid default value.
> I think, this is a good idea anyway...

Alternatively you can try to do flow analysis to see
which variables can't be nil, ever, and change their
type from 'a myref to 'a. Ocaml will propagate the typing
and your result will be optimised .. but you will need to change
all uses to match .. meaning you'll have to do type analysis
yourself .. Ocaml will check your analysis, but it won't
do it for you.

In Felix I do this kind of thing, and the generated C++
is again type checked by  g++, so only casting errors
tend to escape early detection. Its very nice to check
your static type checking with someone else's static
type checker :)

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Looking for collaborators on a hobby project
@ 2004-05-27 21:11 Christian Szegedy
  2004-05-27 22:09 ` skaller
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Szegedy @ 2004-05-27 21:11 UTC (permalink / raw)
  To: caml-list

Dear Skaller!

Is the Vyper project public?

I could not find any version of Vyper on the net. :(

You have written, that the analyis of the type information
turned out be difficult. I can believe this. :)

However, this is something already solved. In fact,
this is solved in Ocaml! So, I would not have to solve it
directly.

Now, my idea is the following:

Suppose, we have the following Ruby class:

class A
   def f(x,y)
      x.g(y,@a)
   end
  
   def h(x)
       f(@b,v)
   end
end

Then the interpreter  would simply transform it to the following OCaml 
class:


type 'a myref = Nil | Obj of 'a

let use x = match x with
| Obj x -> x
| Nil -> failwith "Dereferencing nil"


class ['f_x,'f_y,'h_x,'a,'b] a =
object(self)
  val mutable a:('a myref) = Nil
  val mutable b:('b myref) = Nil
  method f ( x : 'f_x) (y : 'f_y) = (use x)#g y a
  method h ( v : 'f_x)  = self#f b v
end

After that, OCaml would take care of all the typing stuff...

Of course using the myref class comes with a performance penalty also.
This can be eliminated if one does not allow nil at all: that is all
instance variables must have valid default value.
I think, this is a good idea anyway...



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-28  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 20:21 [Caml-list] Looking for collaborators on a hobby project Christian Szegedy
2004-05-26 21:36 ` Brandon J. Van Every
2004-05-26 21:37   ` Richard Jones
2004-05-28  9:17 ` Richard Zidlicky
2004-05-27 21:11 Christian Szegedy
2004-05-27 22:09 ` skaller
2004-05-27 23:00   ` Christian Szegedy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).