Re: Help mechanism in REPL?

2016-09-10 Thread Elizabeth Mattijsen
FWIW, the .WHY is a method just like any other.  What would need to be changed, 
is the behaviour of Mu.WHY (around line 60 in Mu.pm).

> On 10 Sep 2016, at 16:41, Brad Gilbert  wrote:
> 
> There was some talk in the past about having `.WHY` look up the
> descriptions in the POD6 doc ( so that we don't have to bloat Rakudo
> with that information )
> 
> On Fri, Sep 9, 2016 at 6:30 PM, Alex Elsayed  wrote:
>> On Wednesday, 7 September 2016 17:57:32 PDT Parrot Raiser wrote:
>>> This isn't a request for a feature, merely a thought experiment. We're
>>> still in the phase where it's more important to ensure that existing
>>> features work properly than add new ones.
>>> 
>>> How difficult would it be to include a mechanism within the REPL to
>>> select either documentation or an example, (possibly from the test
>>> suite), for a particular command? Selection might be by some control
>>> key combination,  cursor positioning, or an alternative to "enter" at
>>> the end of the line. The purpose would be to speed development, by
>>> enabling an inexperienced developer to look up details while testing.
>>> 
>>> Syntax errors generate messages which attempt to provide help; could
>>> this provide the basis for a "help" mechanism? Would this be useful?
>>> 
>>> Opinions?
>> 
>> Well, this sounds like a job for the meta-object protocol (specifically,
>> `.WHY`):
>> 
>> https://docs.perl6.org/language/mop#WHY
>> 
>> The simplest option for handling this in the REPL is probably to have some
>> sort of automatic handling of Pod sent to sink context, rendering it and
>> sending it to a pager. Then, the user could simply do
>> 
 Hash.WHY
>> (LET THERE BE DOCS!)
>> 
>> And there would be docs.



Re: Help mechanism in REPL?

2016-09-10 Thread Brad Gilbert
There was some talk in the past about having `.WHY` look up the
descriptions in the POD6 doc ( so that we don't have to bloat Rakudo
with that information )

On Fri, Sep 9, 2016 at 6:30 PM, Alex Elsayed  wrote:
> On Wednesday, 7 September 2016 17:57:32 PDT Parrot Raiser wrote:
>> This isn't a request for a feature, merely a thought experiment. We're
>> still in the phase where it's more important to ensure that existing
>> features work properly than add new ones.
>>
>> How difficult would it be to include a mechanism within the REPL to
>> select either documentation or an example, (possibly from the test
>> suite), for a particular command? Selection might be by some control
>> key combination,  cursor positioning, or an alternative to "enter" at
>> the end of the line. The purpose would be to speed development, by
>> enabling an inexperienced developer to look up details while testing.
>>
>> Syntax errors generate messages which attempt to provide help; could
>> this provide the basis for a "help" mechanism? Would this be useful?
>>
>> Opinions?
>
> Well, this sounds like a job for the meta-object protocol (specifically,
> `.WHY`):
>
> https://docs.perl6.org/language/mop#WHY
>
> The simplest option for handling this in the REPL is probably to have some
> sort of automatic handling of Pod sent to sink context, rendering it and
> sending it to a pager. Then, the user could simply do
>
>>> Hash.WHY
> (LET THERE BE DOCS!)
>
> And there would be docs.


Re: Help mechanism in REPL?

2016-09-10 Thread Rob Hoelz
On Fri, 09 Sep 2016 16:30:28 -0700
Alex Elsayed  wrote:

> On Wednesday, 7 September 2016 17:57:32 PDT Parrot Raiser wrote:
> > This isn't a request for a feature, merely a thought experiment.
> > We're still in the phase where it's more important to ensure that
> > existing features work properly than add new ones.
> > 
> > How difficult would it be to include a mechanism within the REPL to
> > select either documentation or an example, (possibly from the test
> > suite), for a particular command? Selection might be by some control
> > key combination,  cursor positioning, or an alternative to "enter"
> > at the end of the line. The purpose would be to speed development,
> > by enabling an inexperienced developer to look up details while
> > testing.
> > 
> > Syntax errors generate messages which attempt to provide help; could
> > this provide the basis for a "help" mechanism? Would this be useful?
> > 
> > Opinions?  
> 
> Well, this sounds like a job for the meta-object protocol
> (specifically, `.WHY`):
> 
> https://docs.perl6.org/language/mop#WHY
> 
> The simplest option for handling this in the REPL is probably to have
> some sort of automatic handling of Pod sent to sink context,
> rendering it and sending it to a pager. Then, the user could simply do
> 
> >> Hash.WHY  
> (LET THERE BE DOCS!)
> 
> And there would be docs.
> 

+1 to this; it wouldn't be too hard to have the REPL pick up on Pod types and 
render them
properly.  However, hardly any of the core types or subs have a WHY (due to 
Rakudo setting
compilation time).  There were a few ideas flying around a while ago about how 
to remedy this:

  - Generate a postamble that is optionally included in the setting that sets 
up WHY for core objects
retroactively.

  - Alter WHY's implementation slightly so that if an object has no WHY 
associated with it, there is
the option to consult a "WHY repository", which would store WHYs 
off-setting on disk or as a service
on docs.perl6.org.

I think that Parrot Raiser's original intent, in addition to object and 
function-specific help, was offering
broader categories of help from within the REPL, like Python's 
"help('keywords')".


Re: Help mechanism in REPL?

2016-09-09 Thread Alex Elsayed
On Wednesday, 7 September 2016 17:57:32 PDT Parrot Raiser wrote:
> This isn't a request for a feature, merely a thought experiment. We're
> still in the phase where it's more important to ensure that existing
> features work properly than add new ones.
> 
> How difficult would it be to include a mechanism within the REPL to
> select either documentation or an example, (possibly from the test
> suite), for a particular command? Selection might be by some control
> key combination,  cursor positioning, or an alternative to "enter" at
> the end of the line. The purpose would be to speed development, by
> enabling an inexperienced developer to look up details while testing.
> 
> Syntax errors generate messages which attempt to provide help; could
> this provide the basis for a "help" mechanism? Would this be useful?
> 
> Opinions?

Well, this sounds like a job for the meta-object protocol (specifically, 
`.WHY`):

https://docs.perl6.org/language/mop#WHY

The simplest option for handling this in the REPL is probably to have some 
sort of automatic handling of Pod sent to sink context, rendering it and 
sending it to a pager. Then, the user could simply do

>> Hash.WHY
(LET THERE BE DOCS!)

And there would be docs.


Help mechanism in REPL?

2016-09-07 Thread Parrot Raiser
This isn't a request for a feature, merely a thought experiment. We're
still in the phase where it's more important to ensure that existing
features work properly than add new ones.

How difficult would it be to include a mechanism within the REPL to
select either documentation or an example, (possibly from the test
suite), for a particular command? Selection might be by some control
key combination,  cursor positioning, or an alternative to "enter" at
the end of the line. The purpose would be to speed development, by
enabling an inexperienced developer to look up details while testing.

Syntax errors generate messages which attempt to provide help; could
this provide the basis for a "help" mechanism? Would this be useful?

Opinions?