🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #81

Re: Optimization by programmers

#81
From: Anton Ertl
Date: Tue, 13 Oct 2026 16:31
48 lines
3239 bytes
Andy Valencia <vandys@vsta.org> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> hex \ change to base #16
>> add \ is this a dictionary word, or a number?
>> 
>> The classic ways to avoid this has been to
>> 
>> 1) prefix hex numbers with 0 if they would otherwise start with a
>>    letter.  Dictionary words rarely start with digits, and when they
>>    do, they don't conflict with hex numbers.
>
>Alternately, Forth could adopt practices which have become broad,
>de facto standards.  So, referencing above, instead hex numbers
>have a 0xadd prefix, and you don't switch the base of the system.

I don't change the base for inputting numbers, and use the
standardized prefix $ instead ($add), as mentioned.  A number of
systems recognize numbers with the prefix 0x as hex numbers, too.
Finally, you can add user-defined recognizers in a number of Forth
systems, and recognize 0x-prefixed numbers on these systems.

>While you're at it, start the transition to "//" as the comment
>token.

You can define that yourself if you want:

: // 0 parse 2drop ; immediate

But unlike for the 0x prefix, few Forth systems have implemented //
comments, so demand for that is low.  And why should there be demand
for it?

For the 0x prefix, the demand comes from interoperating with
C-oriented tools that output hex numbers with a 0x prefix.  But
comments have no such interoperability issues.

>From memory, who's holding out?  Only Forth, Smalltalk, and
>COBOL come to mind.

Most programming languages use something else for comments: Unix
shells, Lisp, Makefiles, assembly language, Postscript and Ada come to
my mind.  Maybe some of them also accept //, but I have yet to see a
program in one of these languages that uses such a comment.

- anton
-- 
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>
Technical Details
Message-ID: <2026Oct13.183123@mips.complang.tuwien.ac.at>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <1791742457-5857@newsgrouper.org> <11agm4p$2tfut$1@dont-email.me> <11ahs8q$38ir0$4@dont-email.me> <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Optimization by programmers
Date: Tue, 13 Oct 2026 16:31:23 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 48
Message-ID: <2026Oct13.183123@mips.complang.tuwien.ac.at>
References: <1791742457-5857@newsgrouper.org> <11agm4p$2tfut$1@dont-email.me> <11ahs8q$38ir0$4@dont-email.me> <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org>
Injection-Date: Tue, 13 Oct 2026 16:57:26 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="671067"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+v991v8bQSBqMjDsO9BxzM"; posting-host="fe61e7b3cd0f773f794eaa5f8cfc4f56"
Cancel-Lock: sha1:8k4rkLGzC7AWIBJmkUHw87NiwtA= sha256:BZWJ2IZb9/gxc0FozXhwWQs1Lk8Bxvu4YxPEwUe307Q=
	sha1:Eq6FIHah+cJQ2foZIeBj9M7ahR0= sha256:sr1+DgS1L31Mw8o1ODKfbVL6L3QsRp1GTDQDQRW+k6M=
X-newsreader: xrn 10.11