From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: defining macros
Date: Sat, 11 Jan 2025 12:30:41 +0100 [thread overview]
Message-ID: <dd12238e-88c9-4bc2-a0bb-38c07e8d4489@freedom.nl> (raw)
In-Reply-To: <9c96f651-6373-49ed-b51b-9f1781e35a18@fiee.net>
On 1/11/2025 10:21 AM, Henning Hraban Ramm wrote:
> Am 11.01.25 um 00:19 schrieb Hans Hagen:
>>> Yes, of course, but I’m often surprised by funny characters like #:
>>
>> Well, there are reasons: It has to fit in the #1 .. #9 approach because
>> these things are stored into tokens, so single character. Then one has
>> to decide on what characters. There's also a performance issue because
>> we don't want to sacrifice too much and these preamble tokens are
>> "parsed" every time a macro is called so they better can be efficient.
>>
>> In the end only a few users (mostly developers) will see the obscure
>> ones (and understand why some are there). The \optional prefix enables
>> these extensions. It's a bit like: I want to grab arguments with
>> mandate {} and there is something so let's look it up. Or, I bet that
>> one can grab \par's so lets the manual for that.
>
> Thank you for the explanation!
> I guess you meant \tolerant instead of \optional?
yes, (i sometimes localy uise that as aliasm, sorry) .. consider that
you just past the examn
>> Did you know that we can have #A..#E as well. So 15 parameters instead
>> of 9? I still need to use that more (deep down).
>
> That I knew. At least in mkvi/mklx mode.
> If I use even 4 params I lose count of them.
>
>> Don't worry, you don't want to know what I forget.
\tolerant\def\MyMacro[#1]#:#2%
{\parameterdef\ikeepforgettingone1
\parameterdef\ikeepforgettingtwo2
\ifparameter#1\or % maybe here too
(\ikeepforgettingone)
\fi
/\ikeepforgettingtwo/}
\MyMacro[one]{two}
\MyMacro{two}
seems that i also need to let \ifparameter handle these defs ... so now
you contributed to development (and i can delegate documentation of low
levels to you)
> Sure.
> I’m proud to have found several features that you forgot about ;)
ah, so you now make a nice certificate that you can put behind you when
we chat
>>> I’m not competent enough to rewrite e.g.
>>> https://wiki.contextgarden.net/System_Macros/Handling_Arguments
>>
>>> Sigh.
>>
>> So you haven't reached Wolfgang level yet, and by the time you have,
>> he bumped the scale up again, so don't sigh too much ... won't help,
>> actually your upcoming manual will cover plenty, so more of a hurray.
>
> I’m always aiming for the stars. ;)
> But my manual can’t be better than me, and I want it to be up to date
> and helpful – mostly for myself ;-P
>
> Yes, I need to read the lowlevel manuals. But after taxes… (Also sigh.)
>
> Hraban
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/
> ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2025-01-11 11:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 11:55 [NTG-context] " Henning Hraban Ramm
2025-01-10 18:45 ` [NTG-context] " Hans Hagen via ntg-context
2025-01-10 22:04 ` Henning Hraban Ramm
2025-01-10 23:19 ` Hans Hagen
2025-01-11 9:21 ` Henning Hraban Ramm
2025-01-11 11:30 ` Hans Hagen via ntg-context [this message]
2025-01-14 17:50 ` Henning Hraban Ramm
2025-01-14 18:27 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd12238e-88c9-4bc2-a0bb-38c07e8d4489@freedom.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@freedom.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).