Re: [racket-dev] Racket startup

2011-06-28 Thread Eli Barzilay
8 minutes ago, Matthew Flatt wrote:
> I am too buried in syntax-certificate work at the moment to follow
> along reply properly, but for what it's worth, I have a very
> different proposal in mind: a single file can have multiple loadable
> things (maybe "modulets"), and a program `main' should be one of
> those loadable things --- not an exported function. That resolves
> the problem with picking a special name, and it avoids having to
> load the "main" part when a module is used as a library.

One of the things that I liked about what I suggested was that I could
probably have implemented it today... and nearly started to do so.
Whatever you suggest sounds like its much more powerful, if there's no
need to load the unused parts.  But OTOH, if these things are
separated so strongly, then Jay's complain (distancing `f' from its
tests) might become more of a problem.  Also, I liked the very
convenient way to have multiple entry points, so I hope that that will
be as convenient.


But...

> I hope to reply more properly soon.

...I'll wait (im-)patiently.

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Eli Barzilay
Three minutes ago, Sam Tobin-Hochstadt wrote:
> On Tue, Jun 28, 2011 at 9:52 AM, Eli Barzilay  wrote:
> >
> > 2. BTW, `-um- foo.rkt' would *not* be the same as `-R foo.rkt main',
> >   because `-m' is disconnected from a specific module.  That makes it
> >   still have some use as a more generic thing, but you pay for that
> >   with the verbosity of an explicit `provide'.
> 
> I'm confused about how exactly this is different, except in the cases
> where `-um- foo.rkt' would error.

`-m' can work at any point on the command line, so you could `-t' a
bunch of modules, and add a `-m' in the end, and that will use
whatever `main' was provided.  That's why it's not specific to a
command-line module, so by its (more generic) design it can't be made
convenient by dropping the `provide'.

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] Racket startup

2011-06-28 Thread Sam Tobin-Hochstadt
On Tue, Jun 28, 2011 at 9:52 AM, Eli Barzilay  wrote:
>
> 2. BTW, `-um- foo.rkt' would *not* be the same as `-R foo.rkt main',
>   because `-m' is disconnected from a specific module.  That makes it
>   still have some use as a more generic thing, but you pay for that
>   with the verbosity of an explicit `provide'.

I'm confused about how exactly this is different, except in the cases
where `-um- foo.rkt' would error.
-- 
sam th
sa...@ccs.neu.edu

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Matthew Flatt
I am too buried in syntax-certificate work at the moment to follow
along reply properly, but for what it's worth, I have a very different
proposal in mind: a single file can have multiple loadable things
(maybe "modulets"), and a program `main' should be one of those
loadable things --- not an exported function. That resolves the problem
with picking a special name, and it avoids having to load the "main"
part when a module is used as a library.

I hope to reply more properly soon.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Carl Eastlund
On Tue, Jun 28, 2011 at 11:27 AM, Eli Barzilay  wrote:
> An hour ago, Carl Eastlund wrote:
>> On Tue, Jun 28, 2011 at 10:20 AM, Eli Barzilay  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.', `', 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.

--Carl

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Eli Barzilay
An hour ago, Carl Eastlund wrote:
> On Tue, Jun 28, 2011 at 10:20 AM, Eli Barzilay  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.', `', or `main:'?

All of this makes me think that `MAIN' is better.  Or maybe `Main'.

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] Racket startup

2011-06-28 Thread Carl Eastlund
On Tue, Jun 28, 2011 at 10:20 AM, Eli Barzilay  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.)  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?

--Carl

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Eli Barzilay
8 minutes ago, Neil Van Dyke wrote:
> Eli Barzilay wrote at 06/28/2011 09:52 AM:
> > This makes `MAIN' the Racket equivalent of Python's `__main__' thing.
> 
> As for the name, if you could promise me that this name isn't a
> slippery slope to a proliferation of all-uppercase variable names...
> (By convention, I use all-uppercase for pattern variables in macro
> transformers, and that is the best use of them I've found so far.)

It's really just the first thing I could think of that wouldn't clash
with anything.  `__main__' is such an option too...  But more
seriously, I could only think of things like `on-run' or `script' or
something like that, which don't look as good.  In any case, `MAIN' is
in no way important.


> As for adding Python/Ruby/Perl-esque automagical behavior and hacks,
> I trust that people will do so with judicious hesitation.  Sometimes
> a hack is the most sensible way, but Racket is mostly not Hacket.

Well, by making the language provide it, and using the same semantics
of overriding bindings that came with your language to change it, it
gets (IMO) elevated from "a hack" to "a convenient feature".


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...)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Carl Eastlund
On Tue, Jun 28, 2011 at 10:06 AM, Neil Van Dyke  wrote:
> Eli Barzilay wrote at 06/28/2011 09:52 AM:
>>
>> This makes `MAIN' the Racket equivalent of Python's `__main__' thing.
>
> As for the name, if you could promise me that this name isn't a slippery
> slope to a proliferation of all-uppercase variable names...  (By convention,
> I use all-uppercase for pattern variables in macro transformers, and that is
> the best use of them I've found so far.)

The Racketish name would be #%main, wouldn't it?

--Carl

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Racket startup

2011-06-28 Thread Neil Van Dyke

Eli Barzilay wrote at 06/28/2011 09:52 AM:

This makes `MAIN' the Racket equivalent of Python's `__main__' thing.


As for the name, if you could promise me that this name isn't a slippery 
slope to a proliferation of all-uppercase variable names...  (By 
convention, I use all-uppercase for pattern variables in macro 
transformers, and that is the best use of them I've found so far.)


As for adding Python/Ruby/Perl-esque automagical behavior and hacks, I 
trust that people will do so with judicious hesitation.  Sometimes a 
hack is the most sensible way, but Racket is mostly not Hacket.


--
http://www.neilvandyke.org/
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev