Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #43201

Re: namespace

From kristoff <kristoff@skypro.be>
Newsgroups comp.lang.forth
Subject Re: namespace
Date 2015-11-03 23:11 +0100
Organization A noiseless patient Spider
Message-ID <n1bb9q$fkf$1@dont-email.me> (permalink)
References (3 earlier) <n0be4i$o28$1@dont-email.me> <n0jket$d66$1@dont-email.me> <EOydnbJr_udQwbDLnZ2dnUU7-SOdnZ2d@supernews.com> <n0jnel$qnn$1@dont-email.me> <vpedna68erz18rDLnZ2dnUU7-eWdnZ2d@supernews.com>

Show all headers | View raw


Elizabeth,



(Sorry for the late reply. It's been a strange couple of weeks).



On 26-10-15 01:10, Elizabeth D. Rather wrote:
 >> $40013800 constant USART1_Base
 >> USART1_Base $08 + constant Terminal_USART1_BRR
 >> : setusart_8Mhz
 >> $46 Terminal_USART1_BRR !
 >> ;
 >> --- cut here --- cut here --- cut here ----
 >> I know this is a lot of text for just 1 action, but -for me- the goal is
 >> opensource code is not only to do its work, but also to explain to
 >> others how something work.
 >> So, in this case, do I put these two constants in a seperate worldlist
 >> or not?
 >> (of course, this is just one of the words in this "library").

 > No, they certainly don't belong in a separate namespace! What is the
 > likelihood you'll have a word named USART1_Base or Terminal_USART1_BRR
 > with different values?

Well, my principe has been then "coding" and "making assumptions" make 
not very good friends.

The core idea of open-source is software reusability. And this means you 
know your code will be used by other people, so you try to make sure you 
stay out of everybody's way as much as possible.

You are correct that there the chance somebody else will use the same 
name is pretty slim, but that is not really the point. If there is no 
reason for a application programmer to interact with 
"Terminal_USART_BRR", what is the logic of having it visible to him/her?




 > The purpose of a separate space is to enable you to use the same names
 > for analogous functions in different contexts. For example, Open
 > Firmware provides drivers for a lot of devices that may be attached to
 > your computer. Every driver has "methods" such as OPEN, CLOSE, READ,
 > WRITE, INIT, etc., but they all do device-specific things. So each is in
 > a separate wordlist that you specify by naming the device, e.g.:
 >
 > DISK1 OPEN
 > DISK2 OPEN

Do you mean, "open" of two different kinds of disks, or is this two 
instances of one type of disk?


 > KEYBOARD READ
 > ....etc. where the name selects the device's wordlist so that you get
 > the appropriate method for that device.

I see.

Now, let's concider something like a software-serial interface. How 
would you advice coding that?
Do you need a seperate worldlist per instance, or can you create 
multiple instances of one worldlist, everyone with its own private data?




 > Cheers,
 > Elizabeth

Cheerio! Kr. Bonne.

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Forth and "embedded" enviroment kristoff <kristoff@skypro.be> - 2015-10-22 00:23 +0200
  Re: Forth and "embedded" enviroment Roberto Waltman <usenet@rwaltman.com> - 2015-10-21 19:19 -0400
  Re: Forth and "embedded" enviroment rickman <gnuarm@gmail.com> - 2015-10-21 21:59 -0400
    Re: Forth and "embedded" enviroment kristoff <kristoff@skypro.be> - 2015-10-22 15:37 +0200
      Re: Forth and "embedded" enviroment rickman <gnuarm@gmail.com> - 2015-10-22 15:43 -0400
        Re: Forth and "embedded" enviroment jonjo <jjonethal@yahoo.de> - 2015-10-22 15:26 -0700
          Re: Forth and "embedded" enviroment rickman <gnuarm@gmail.com> - 2015-10-23 03:20 -0400
        namespace (was: Forth and "embedded" enviroment) kristoff <kristoff@skypro.be> - 2015-10-25 23:20 +0100
          Re: namespace Paul Rubin <no.email@nospam.invalid> - 2015-10-25 15:45 -0700
            Re: namespace kristoff <kristoff@skypro.be> - 2015-10-25 23:53 +0100
              Re: namespace Paul Rubin <no.email@nospam.invalid> - 2015-10-25 16:18 -0700
                Re: namespace "Elizabeth D. Rather" <erather@forth.com> - 2015-10-25 14:01 -1000
                Re: namespace Paul Rubin <no.email@nospam.invalid> - 2015-10-25 17:40 -0700
          Re: namespace "Elizabeth D. Rather" <erather@forth.com> - 2015-10-25 12:50 -1000
            Re: namespace kristoff Bonne <kristoff@skypro.be> - 2015-10-26 00:11 +0100
              Re: namespace "Elizabeth D. Rather" <erather@forth.com> - 2015-10-25 14:10 -1000
                Re: namespace kristoff <kristoff@skypro.be> - 2015-11-03 23:11 +0100
                Re: namespace "Elizabeth D. Rather" <erather@forth.com> - 2015-11-03 16:17 -1000
                Re: namespace kristoff <kristoff@skypro.be> - 2015-11-07 17:56 +0100
          Re: namespace (was: Forth and "embedded" enviroment) hughaguilar96@gmail.com - 2015-10-25 16:31 -0700
          Re: namespace (was: Forth and "embedded" enviroment) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-26 11:23 +0000
        Re: Forth and "embedded" enviroment kristoff <kristoff@skypro.be> - 2015-11-03 12:16 +0100
          Re: Forth and "embedded" enviroment rickman <gnuarm@gmail.com> - 2015-11-03 11:12 -0500
            Re: Forth and "embedded" enviroment kristoff <kristoff@skypro.be> - 2015-11-04 14:06 +0100
              Re: Forth and "embedded" enviroment rickman <gnuarm@gmail.com> - 2015-11-04 09:29 -0500
  Re: Forth and "embedded" enviroment Matthias Koch <matthias.koch@hot.uni-hannover.de> - 2015-10-22 11:13 +0200
    Re: Forth and "embedded" enviroment kristoff <kristoff@skypro.be> - 2015-10-22 15:54 +0200
      Re: Forth and "embedded" enviroment Matthias Koch <matthias.koch@hot.uni-hannover.de> - 2015-10-22 16:42 +0200

csiph-web