[racket-dev] Racket startup

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue Jun 28 11:32:32 EDT 2011

On Tue, Jun 28, 2011 at 11:27 AM, Eli Barzilay <eli at barzilay.org> wrote:
> An hour ago, Carl Eastlund wrote:
>> On Tue, Jun 28, 2011 at 10:20 AM, Eli Barzilay <eli at barzilay.org> wrote:
>> > Three minutes ago, Carl Eastlund wrote:
>> >>
>> >> The Racketish name would be #%main, wouldn't it?
>> >
>> > Yes.  But the problem is that `#%foo' names are intended to be
>> > things that you don't write in end-user code, only if you
>> > implement a new language or change some fundamental thing.  In
>> > that respect, the `#%' feels like serving the same role as `__',
>> > which feels dirty.  (I'm also trying to imagine the first-time
>> > user impression being told to define `#%main' vs `main' -- the
>> > first looks like it leads to an impression of some perl-like
>> > language...)
>> Yeah, I agree completely, I was just looking for alternatives to
>> MAIN.  Now we need an alternative to both.  What was wrong with just
>> main, again?  (Looking back... oh, you said not clashing with
>> existing code.)
> Yes.  Unfortunately, reusing `main' means that current code that
> current uses for it (to achieve two running modes) breaks.
>> Well, we go in for verbose, self-explanatory names (e.g.
>> current-command-line-arguments), how about the-main-program or
>> start-program-here or something similar?
> I really want to find something short.  Not only to make it very easy
> to remember, but also to minimize the transition step from things like
>  (printf "Hi, I'm a very quick script.\n")
> to
>  (define (MAIN . _)
>    (printf "Look at me, I'm a more serious application now.\n"))
> BTW, I also considered `run', but that's something that I've used in a
> few places, and I'm sure I'm not the only one.
> [/me fires up a thesaurus.]
> [/me gets frustrated.]
> How about one of these:
> - `start'
> - `launch'
> - `execute'
> - `act'
> - `invoke'
> - `*main*'
> ?
> The thing that makes `main' more appealing is that it's conventional,
> and that it's more like "the default entry point".  That's why I
> included the `*main*' thing.  Also, given that any of these could be
> used in an existing file, maybe some extra punctuation is inevitable.
> So maybe things like `main.', `<main>', or `main:'?
> All of this makes me think that `MAIN' is better.  Or maybe `Main'.

Both MAIN and Main are very un-Racketish names.  I don't think they
should be part of a common programming pattern.  The appeal of main is
strong enough I wonder if we might consider breaking legacy code in
order to make this pattern idiomatic.  Otherwise, my vote is for
launch or start.


Posted on the dev mailing list.