Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!uhccux!dunn From: dunn@uhccux.uhcc.hawaii.edu (John Dunn) Newsgroups: comp.lang.forth Subject: Re: ANS TC Magnet for Interpreter Message-ID: <6216@uhccux.uhcc.hawaii.edu> Date: 17 Jan 90 23:04:28 GMT References: <9001172005.AA21025@jade.berkeley.edu> Reply-To: dunn@uhccux.UUCP (John Dunn) Organization: University of Hawaii Lines: 27 In article <9001172005.AA21025@jade.berkeley.edu> Forth Interest Group International List writes: >> ... discussion about various ways to specify explicit number base ... >> MB: H# D# >> RB: %, etc >> FS: $, h', etc > >The trouble with this topic is that everybody in the whole world has >a different idea about what "looks" good. Everybody is "used" to something >from exposure to some random assembly language. > I'm not sure what the fuss is about here. For years, over several different Forths, I have simply trapped the string before it gets to NUMBER, and look for an appended character that designates a specified base. My preference happens to be "H" for hex, and the default is decimal, but so what - the character can be any non-numeric you pick. The trap routine looks at the string, and if the character is detected as the last character of the string (could be the first character, but my preference is to use the last), the current base is pushed to the stack, BASE is changed, the character is stripped from the string, and NUMBER is called. Then the BASE is restored. Simple, and works just fine. Forths that vector NUMBER make this especially easy, but I have never had much trouble finding a way to redefine low level words regardless of the implementation. One of the nicer features of Forth. -John Dunn