From: Hans Hagen <j.hagen@xs4all.nl>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: defining macros
Date: Tue, 14 Jan 2025 19:27:28 +0100 [thread overview]
Message-ID: <e7e93ce6-b179-4131-b6fd-dcf439ebee2f@xs4all.nl> (raw)
In-Reply-To: <f0ac2605-029e-45ee-845b-1aa708aa2f89@fiee.net>
On 1/14/2025 6:50 PM, Henning Hraban Ramm wrote:
> Am 11.01.25 um 12:30 schrieb Hans Hagen via ntg-context:
>>> 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
>
> Will do ;)
> Do you also give out cheques? ;)
we might if we got them
> Back to macros (I read lowlevel-macros, at least tried to…):
>
> While I liked \define, it looks like it just doesn’t make sense anymore
> if I need (\tolerant)\def for anything advanced anyway?
\starttexdefinition
supports this
> You stress how costly named macros are – then we should forget about
> MkLX mode?
i meant 'if supported by the engine' but mklx are only named when you
define them adnm internalized as #1 ...
> Did I understand correctly, that bracketed = optional parameters is just
> a convention, i.e. only the handling of arguments makes them optional,
> not their definition/fencing?
indeed, you could also do
\tolerant\def\foo(#1){...}
> With \tolerant, we can not only forget about the last dodos (and even
> single dos), but also about \dosingleargument & friends, right?
> Are there cases where the MkIV way still makes sense with LMTX?
only a few places (where we were too lazy to redo it) but eventually all
will use the modern way ... if you see one and are annoyed you can tell
me (HH & WS)
> When does it make sense to define macros in Lua (interfaces.implement)?
> Obviously, if I need calculations or I/O operations that are easier to
> do in Lua. Are there disadvantages of Lua-defined vs. TeX-defined macros?
it depends but i doubt if you will notice (often the performance hits
are not where you think they are so one can occasionaly run into curious
assumptions)
timing tex is kind of tricky because in a loop that does simple things
cpu caching speeds up things contrary to doing things all over memory
and code; anyway one avoids some tokenization when used right
if one noticed a bottleneck we can look into but as we don't get
complaints i guess performance is ok
Hans
-----------------------------------------------------------------
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
___________________________________________________________________________________
prev parent reply other threads:[~2025-01-14 18:28 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
2025-01-14 17:50 ` Henning Hraban Ramm
2025-01-14 18:27 ` Hans Hagen [this message]
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=e7e93ce6-b179-4131-b6fd-dcf439ebee2f@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.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).