Menu

#1 adding ocaml-like pack?

open
5
2006-03-10
2006-03-10
No

Felix may already support this, but I haven't run across it. I was just
browsing through the std source, and it was pretty jumbled together with
all of the modules in the same place. So, I was thinking that it would be
nice if each of these modules could be in their own file (eg: C_hack.flx),
but still only be accessable via the std module. There are a couple
approaches that can be taken. First, c++ namespaces. Second, python's
__init__.py file. And third, ocaml's packed modules. Personally, I'd prefer
the last solution. It's just like the python one in that you can migrate a
dense file into multiple files, but it doesn't force any special directory
layout. What do you all think?

Discussion

  • John Skaller

    John Skaller - 2006-03-10
    • assigned_to: nobody --> skaller
     
  • John Skaller

    John Skaller - 2006-03-10

    Logged In: YES
    user_id=5394

    Modularising the library is indeed necessary. Exactly how
    remains to be determined. Already, the library consists of
    modules and files. I actually don't like Ocaml's -pack
    option, I think its a hack. OTOH both Ocaml and Python
    couple module concepts with files -- Python also couples
    directory structure with modules. C and C++ on the other
    hand separate module/compilation unit/namespace from the
    file system.

    For Felix, composition consisting of grouping isn't enough,
    extensible with plugins or not: we also need alternatives.

    That can be done with shadowing files via search paths, but
    that isn't really right either. Alternatives are need for
    things like: choose Windows or Posix implementation or
    interface for thread, or, use std memcpy, or, if you have
    gcc and AMD64 use this other assembler routine instead.

    All of this is fairly easy with executable code but
    module/file structures are declarative. That's why C
    actually uses executable code -- namely preprocessor
    conditional compilation and macros.

    Anyhow, I assigned this to me for the moment because it's
    very close to the core language design. But ideas are needed!

     
  • Erick Tryzelaar

    Erick Tryzelaar - 2006-03-10
    • labels: --> Language Design
     

Log in to post a comment.