logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: About iterators and enums: msg#00138

Subject: Re: About iterators and enums
On Thu, Apr 29, 2004 at 10:48:31PM +0200, Nicolas Cannasse wrote:

[--snip stuff about enums--]

Thank you, sir. You said it so much better than I ever could. :)

> OCaml is not python : providing a port of a Python library is certainly nice 
> for
> interfacing, but as nothing to do in a general purpose library such as
> ExtLib. 

/me thinks it does. :) To me it would be so useful that it
absolutely deserves to be part of ExtLib. (To me,
interoperability is not part of the reason I think it
should be included... see below).

> If you come up with a version of ConfigParser that can enforce the
> config file structure and types using a kind of typed-DTD
[...]
> Having generators of caml type from the typed-DTD will be a killer.

Say what? It seems to me you're over-complicating things to the
point of absurdity.

There is a very good reason that the ConfigParser module
in Python is like it is (and it has nothing to do with
Python as a language): It is simply _the_ most convenient
and _simple_ way to parse user-editable configuration
files! There is nothing that comes close!

I mean, what could possibly be easier than:

        let my_server =
            ConfigParser.get_string ~section:"global" "server"
        and my_port =
            ConfigParser.get_int ~section:"global" "port"
        and my_bla =
            ConfigParser.get_float ~section:"some_section" "bla"
        [...]

You could even add a bit more compile-time checking by
using section tags, as in:
         
             let global_section =
                  ConfigParser.get_section ... "global" in
             let my_server =
                  ConfigParser.get_string global_section "server"
             ....

You may objects that this is not all that general in that
it doesn't allow parsing of arbitrarily-typed values from
the config file. But why should that be a concern? People
simply do not need configuration settings that are more
complicated than those already available in the
ConfigParser(py) module. If they did, people would be
asking the python developers for them! (and the python
developer would likely be happy to oblige, they usually
are :))

Wrt. specifying various types of values (int,float,string)
by using different formatting in the config file... My
question is simply: Why? I can see absolutely no benefit
to doing this. You can still just as easily get exceptions
at parse time, and if the user doesn't already know that
some setting should be an int, then they have no business
editing that config file!

Sorry, if I come across as confrontational/annoyed, but I
am a _huge_ fan of ConfigParser (the python one that is),
I use it in all my Python-based projects where persistent
configuration is even slightly useful..

-- 
Bardur Arantsson
<bardur@xxxxxxxxxxxx>
<bardur@xxxxxxxxxxxxxxx>

- I didn't have a blunt object with me, so I said "OK".
                                  David Letterman | The Late Show


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>