ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] LuaMetaTeX code
@ 2024-01-19  8:26 Shiv Shankar Dayal
  2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Shiv Shankar Dayal @ 2024-01-19  8:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 420 bytes --]

Dear Hans,

I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not good
coding practice. These potions of code which have goto should be refactored.

I am a C programmer, but I know very little of TeX. If you can point me
towards where should I start for TeX(perhaps TeX Book or TeX for the
Impatient), I can help with refactoring of code to make is more
efficient/easier.

-- 
Respect,
Shiv Shankar Dayal

[-- Attachment #1.2: Type: text/html, Size: 685 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:26 [NTG-context] LuaMetaTeX code Shiv Shankar Dayal
@ 2024-01-19  8:31 ` Shiv Shankar Dayal
  2024-01-19  8:39   ` Taco Hoekwater
  2024-01-19  9:01   ` Hans Hagen
  2024-01-19  8:57 ` Hans Hagen
  2024-01-19  9:11 ` Henri Menke via ntg-context
  2 siblings, 2 replies; 7+ messages in thread
From: Shiv Shankar Dayal @ 2024-01-19  8:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1014 bytes --]

I see code like

# define luametatex_version          210
# define luametatex_revision         10
# define luametatex_release          10
# define luametatex_version_string   "2.10.10"

starting with C99 these become unnecessary. Rather they should be like
const int luametatex_version=210; const char*
luametatex_version_string="2.10.10";

These ensure type-safety in the code and are good coding practice.

On Fri, Jan 19, 2024 at 1:56 PM Shiv Shankar Dayal <
shivshankar.dayal@gmail.com> wrote:

> Dear Hans,
>
> I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not good
> coding practice. These potions of code which have goto should be refactored.
>
> I am a C programmer, but I know very little of TeX. If you can point me
> towards where should I start for TeX(perhaps TeX Book or TeX for the
> Impatient), I can help with refactoring of code to make is more
> efficient/easier.
>
> --
> Respect,
> Shiv Shankar Dayal
>


-- 
Respect,
Shiv Shankar Dayal

[-- Attachment #1.2: Type: text/html, Size: 1755 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
@ 2024-01-19  8:39   ` Taco Hoekwater
  2024-01-19  8:43     ` Shiv Shankar Dayal
  2024-01-19  9:01   ` Hans Hagen
  1 sibling, 1 reply; 7+ messages in thread
From: Taco Hoekwater @ 2024-01-19  8:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Hi Shiv,

Can you move this discussion to the dev-context list, please? https://mailman.ntg.nl/mailman3/lists/dev-context.ntg.nl/

Best wishes,
Taco


> On 19 Jan 2024, at 09:31, Shiv Shankar Dayal <shivshankar.dayal@gmail.com> wrote:
> 
> I see code like
> 
> # define luametatex_version          210
> # define luametatex_revision         10
> # define luametatex_release          10
> # define luametatex_version_string   "2.10.10"
> 
> starting with C99 these become unnecessary. Rather they should be like const int luametatex_version=210; const char* luametatex_version_string="2.10.10";
> 
> These ensure type-safety in the code and are good coding practice.
> 
> On Fri, Jan 19, 2024 at 1:56 PM Shiv Shankar Dayal <shivshankar.dayal@gmail.com> wrote:
> Dear Hans,
> 
> I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not good coding practice. These potions of code which have goto should be refactored.
> 
> I am a C programmer, but I know very little of TeX. If you can point me towards where should I start for TeX(perhaps TeX Book or TeX for the Impatient), I can help with refactoring of code to make is more efficient/easier.
> 
> -- 
> Respect,
> Shiv Shankar Dayal
> 
> 
> -- 
> Respect,
> Shiv Shankar Dayal
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

— 
Taco Hoekwater              E: taco@bittext.nl
genderfluid (all pronouns)


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:39   ` Taco Hoekwater
@ 2024-01-19  8:43     ` Shiv Shankar Dayal
  0 siblings, 0 replies; 7+ messages in thread
From: Shiv Shankar Dayal @ 2024-01-19  8:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2782 bytes --]

Dear Taco,

I will send new messages to dev mailing lists. Let me join it first.

On Fri, Jan 19, 2024 at 2:11 PM Taco Hoekwater <taco@bittext.nl> wrote:

>
> Hi Shiv,
>
> Can you move this discussion to the dev-context list, please?
> https://mailman.ntg.nl/mailman3/lists/dev-context.ntg.nl/
>
> Best wishes,
> Taco
>
>
> > On 19 Jan 2024, at 09:31, Shiv Shankar Dayal <
> shivshankar.dayal@gmail.com> wrote:
> >
> > I see code like
> >
> > # define luametatex_version          210
> > # define luametatex_revision         10
> > # define luametatex_release          10
> > # define luametatex_version_string   "2.10.10"
> >
> > starting with C99 these become unnecessary. Rather they should be like
> const int luametatex_version=210; const char*
> luametatex_version_string="2.10.10";
> >
> > These ensure type-safety in the code and are good coding practice.
> >
> > On Fri, Jan 19, 2024 at 1:56 PM Shiv Shankar Dayal <
> shivshankar.dayal@gmail.com> wrote:
> > Dear Hans,
> >
> > I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not
> good coding practice. These potions of code which have goto should be
> refactored.
> >
> > I am a C programmer, but I know very little of TeX. If you can point me
> towards where should I start for TeX(perhaps TeX Book or TeX for the
> Impatient), I can help with refactoring of code to make is more
> efficient/easier.
> >
> > --
> > Respect,
> > Shiv Shankar Dayal
> >
> >
> > --
> > Respect,
> > Shiv Shankar Dayal
> >
> ___________________________________________________________________________________
> > 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
> >
> ___________________________________________________________________________________
>
> —
> Taco Hoekwater              E: taco@bittext.nl
> genderfluid (all pronouns)
>
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>


-- 
Respect,
Shiv Shankar Dayal

[-- Attachment #1.2: Type: text/html, Size: 4716 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:26 [NTG-context] LuaMetaTeX code Shiv Shankar Dayal
  2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
@ 2024-01-19  8:57 ` Hans Hagen
  2024-01-19  9:11 ` Henri Menke via ntg-context
  2 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2024-01-19  8:57 UTC (permalink / raw)
  To: ntg-context

On 1/19/2024 9:26 AM, Shiv Shankar Dayal wrote:
> Dear Hans,
> 
> I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not 
> good coding practice. These potions of code which have goto should be 
> refactored.
> 
> I am a C programmer, but I know very little of TeX. If you can point me 
> towards where should I start for TeX(perhaps TeX Book or TeX for the 
> Impatient), I can help with refactoring of code to make is more 
> efficient/easier.
Luametatex evolves out of traditional tex so we have/keep some and 
although i grew up in the 'anti goto' times (pascal) there are plenty 
cases where i see no problem. Occasionaly I clean up such bits (when it 
makes sense). And I'm not going to enter coding practice discussions.

Forget about refactoring ... there has already be done a lot of that and 
we want to stay sort of close to the original (also due to 
doicumentation). I know the code quite wel now and refactoring is for me 
counter productive. These are projects running for decades and engines 
need to be stable so changes come slow.

You can compare the luanmetatex source to luatex and pdftex to see how 
we proiceed.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
  2024-01-19  8:39   ` Taco Hoekwater
@ 2024-01-19  9:01   ` Hans Hagen
  1 sibling, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2024-01-19  9:01 UTC (permalink / raw)
  To: ntg-context

On 1/19/2024 9:31 AM, Shiv Shankar Dayal wrote:
> I see code like
> 
> # define luametatex_version          210
> # define luametatex_revision         10
> # define luametatex_release          10
> # define luametatex_version_string   "2.10.10"
> 
> starting with C99 these become unnecessary. Rather they should be like 
> const int luametatex_version=210; const char* 
> luametatex_version_string="2.10.10";
> 
> These ensure type-safety in the code and are good coding practice.
Good coding practice discussions are wasted on me (you don't want me to 
look at your tex code -)

The versioning is abit special in te xdue to the fact thet some numbers 
en dup in registers and others as token list (string). I have considered 
changing that but it would also break some 'testing for tex version' so 
for now we have to accept this mix of tex/etex/pdftex inheritance.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: LuaMetaTeX code
  2024-01-19  8:26 [NTG-context] LuaMetaTeX code Shiv Shankar Dayal
  2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
  2024-01-19  8:57 ` Hans Hagen
@ 2024-01-19  9:11 ` Henri Menke via ntg-context
  2 siblings, 0 replies; 7+ messages in thread
From: Henri Menke via ntg-context @ 2024-01-19  9:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henri Menke

On Fri, 2024-01-19 at 13:56 +0530, Shiv Shankar Dayal wrote:
> Dear Hans,
> 
> I saw the C code of LuaMetaTeX and I saw a lot of gotos which is not
> good
> coding practice. These potions of code which have goto should be
> refactored.

https://xkcd.com/292/

> I am a C programmer, but I know very little of TeX. If you can point
> me
> towards where should I start for TeX(perhaps TeX Book or TeX for the
> Impatient), I can help with refactoring of code to make is more
> efficient/easier.
> 
> _____________________________________________________________________
> ______________
> 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
> _____________________________________________________________________
> ______________

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-19  9:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19  8:26 [NTG-context] LuaMetaTeX code Shiv Shankar Dayal
2024-01-19  8:31 ` [NTG-context] " Shiv Shankar Dayal
2024-01-19  8:39   ` Taco Hoekwater
2024-01-19  8:43     ` Shiv Shankar Dayal
2024-01-19  9:01   ` Hans Hagen
2024-01-19  8:57 ` Hans Hagen
2024-01-19  9:11 ` Henri Menke via ntg-context

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