[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: poke prompt by default
From: |
Jose E. Marchesi |
Subject: |
Re: poke prompt by default |
Date: |
Wed, 22 Nov 2023 17:15:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> Hi Jose.
>
> On Tue, Nov 21, 2023 at 05:24:48PM +0100, Jose E. Marchesi wrote:
>>
>> I wonder:
>>
>> 1. It is easy for the user to write her own pk_prompt function, that may
>> be as complex as desired. However, the default version of the
>> function may use the typical "format string" featuring predefined
>> tags, such as "(%e:%i)" where %e is replaced by the current
>> endianness and %i with the selected IO space or "poke" if no IO
>> space. This could ease a bit customizing prompts, but it would
>> require documentation etc. The question is: would supporting this be
>> worth the effort and maintenance?
>>
>
> TL;DR: We should use Poke. We can provide more prompts in Poke.
>
>
> I disagree with introduing "format string" or other kind of DSL beside the
> Poke.
> Instead we can implement a bunch of different pk_prompt functions with
> different
> options/styles, which (1) can be a source of inspiration for the users and
> (2) easier to maintain and fix for us.
>
> We can also help the user by providing a dot-command to cycle through these
> different prompts. Example:
I would like to avoid introducing more dot-commands as much as possible.
IMO what you suggest (hooks and all) is way more complicated than
providing a prompt function that handles a format string:
var pk_prompt_format = "(%e:%i)";
fun pk_prompt_default = string:
{
/* ... form prompt using pk_prompt_format and retur it ... */
}
fun pk_prompt = string:
{
return pk_prompt_default;
}
So we would document:
1. poke will call the pk_prompt function (which has ()string signature)
in order to get a string with the prompt, every time it needs one.
2. The default definition of pk_prompt uses the format string in
pk_prompt_format in order to format a prompt string, then returns it.
Supported tags are %e, %i, etc.
3. You can use your own definition of pk_prompt just by re-defining it.
Any function is good provided it returns a string. You can call
pk_prompt_default (which uses the global format string) from your
new definition of pk_prompt.
That is all Poke, no need for dot-commands.
The question is: is it worth it?
>
> ```
> (poke) .set prompt
> fixed-string
> endian-filename
> ...
> ```
>
> Then, to select the prompt:
>
> ```
> .set prompt fixed-string
> ```
>
> To change that string:
>
> ```
> .set prompt fixed-string "#!poke!#"
> ```
>
> which will run `pk_prompt_fixed_string = "#!poke!#";' statement.
>
> Easy for user to customize, easier to implement.
>
> I'm not sure about the details of to organize the dot-command, but
> supporting an array of default functions and choosing an index to select
> the default prompt is easy using just Poke (no dot command).
>
> We also provide user with hooks to register functions for prompt.
>
>
>> 2. Is the default prompt the right default? We are usually very
>> conservative with defaults (no pretty-printing, plain output mode,
>> etc) and that may give people the impression that poke is much more
>> limited that it actually is. Should we have a default like mine?
>>
>
>
> Other than pretty-printing (which can be confusing for the new user), yes.
> I think we can improve the user experience by exposing more features.
>
>
> Regards,
> Mohammad-Reza