From: Enoch <ix...@ho...> - 2013-03-16 05:55:59
|
Hello Matthias & All: How about adding a CVARIABLE word to the kernel? It is described in Forth Programmer's Handbook by Conklin & Rather as follows: CVARIABLE <name> ( — ) Create a dictionary entry for name associated with one character of data space. Typically found in smaller systems for embedded micro- controllers and other environments where it is advantageous to allo- cate variables only one character in size. Thanks, Regards, Enoch. |
From: Matthias T. <mt...@we...> - 2013-03-16 14:10:32
|
Hi Enoch, > Hello Matthias & All: > > How about adding a CVARIABLE word to the kernel? Why include it into the kernel? just simply define it yourself. : cvariable variable -1 allot ; btw: i found this file interesting https://github.com/ayrnieu/forth-garden/blob/master/compat.f Esp the "uses" word is smart ;) Matthias |
From: Enoch <ix...@ho...> - 2013-03-16 16:49:23
|
Hello Matthias, Matthias Trute <mt...@we...> writes: >> How about adding a CVARIABLE word to the kernel? > > Why include it into the kernel? just simply define it > yourself. > > : cvariable variable -1 allot ; Implementation is not the issue -- education is (i.e., please be reminded that the AVR is an 8bit µC). > btw: i found this file interesting > > https://github.com/ayrnieu/forth-garden/blob/master/compat.f > > Esp the "uses" word is smart ;) Yes, let's copy'n paste for all the AmForth-ers to see: \ Process the rest of line only if FLAG is true. [IF] .. [THEN] don't \ exist everywhere, so we use this conditional comment word insted. : uses ( flag -- ) 0= IF POSTPONE \ THEN ; It would not occur to the "normal brain" (i.e., tainted by years of other prog languages use) to think of a comment as a programming feature. Thanks, Regards, Enoch. |
From: Matthias T. <mt...@we...> - 2013-03-16 18:42:48
|
Hi Enoch, >> : cvariable variable -1 allot ; > > Implementation is not the issue -- education is (i.e., please be > reminded that the AVR is an 8bit µC). I hope you like http://amforth.sourceforge.net/TG/recipes/RAM-Efficiency.html Matthias PS: the recipe deserves more ideas ;) |
From: Enoch <ix...@ho...> - 2013-03-17 09:30:24
|
Hello Matthias, Matthias Trute <mt...@we...> writes: > Hi Enoch, > >>> : cvariable variable -1 allot ; >> >> Implementation is not the issue -- education is (i.e., please be >> reminded that the AVR is an 8bit µC). > > I hope you like > http://amforth.sourceforge.net/TG/recipes/RAM-Efficiency.html > > Matthias > PS: the recipe deserves more ideas ;) Testing that clever code snippet that you found -- : uses ( flag -- ) 0= IF POSTPONE \ THEN ; revealed that amforth-shell.py needs to be patched again (as it did not understand what that backslash is doing). Here's the patch for your perusal (including some necessary doc work): http://pastebin.com/fDjrjHbN Regards, Enoch. |
From: Enoch <ix...@ho...> - 2013-03-17 10:06:09
|
Enoch <ix...@ho...> writes: > Hello Matthias, > > Matthias Trute <mt...@we...> writes: > >> Hi Enoch, >> >>>> : cvariable variable -1 allot ; >>> >>> Implementation is not the issue -- education is (i.e., please be >>> reminded that the AVR is an 8bit µC). >> >> I hope you like >> http://amforth.sourceforge.net/TG/recipes/RAM-Efficiency.html >> >> Matthias >> PS: the recipe deserves more ideas ;) > > Testing that clever code snippet that you found -- > : uses ( flag -- ) 0= IF POSTPONE \ THEN ; > revealed that amforth-shell.py needs to be patched again (as it did not > understand what that backslash is doing). > Here's the patch for your perusal (including some necessary doc work): > > http://pastebin.com/fDjrjHbN http://pastebin.com/3sxFdZxv (for a stupid unicode issue). Sorry. > > Regards, Enoch. > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Matthias T. <mt...@we...> - 2013-03-17 10:42:55
|
Hi Enoch, >> http://pastebin.com/fDjrjHbN > http://pastebin.com/3sxFdZxv (for a stupid unicode issue). Sorry. I hope I picked the right one. Thanks, applied. Matthias |
From: Macomson, W. <wis...@in...> - 2013-03-20 21:02:07
|
I like this. It may be a good practice to prefix any "cvariable" name with a mnemonic string (e.g., "c_") to help avoid the troublesome behavior noted on Matthias' "...RAM-Efficiency.html" page. -wis -----Original Message----- From: Matthias Trute [mailto:mt...@we...] Sent: Saturday, March 16, 2013 11:43 AM To: Everything around amforth Subject: Re: [Amforth] CVARIABLE Hi Enoch, >> : cvariable variable -1 allot ; > > Implementation is not the issue -- education is (i.e., please be > reminded that the AVR is an 8bit µC). I hope you like http://amforth.sourceforge.net/TG/recipes/RAM-Efficiency.html Matthias PS: the recipe deserves more ideas ;) ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li... https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Matthias T. <mt...@we...> - 2013-03-21 18:38:55
|
Hi Wis, > It may be a good practice to prefix any "cvariable" name with a > mnemonic string (e.g., "c_") to help avoid the troublesome behavior IIRC it is called Hungarian Notation. I'll add a link to the wikipedia article to the recipe. Matthias |
From: Enoch <ix...@ho...> - 2013-03-21 20:24:30
|
Matthias Trute <mt...@we...> writes: > Hi Wis, > >> It may be a good practice to prefix any "cvariable" name with a >> mnemonic string (e.g., "c_") to help avoid the troublesome behavior > > IIRC it is called Hungarian Notation. I'll add a link > to the wikipedia article to the recipe. But Leo Brodie is defintely not Hungarian :-) He writes about Choosing Names: The Art Choose names according to “what,” not “how” "But good names are essential for readability. Moreover, the mental exercise of summoning a one-word description bears a synergistic effect on your perceptions of what the entity should or should not do." Let's leave the Hungarian method to Microsoft, where it was invented. It is an essential evil when managing large projects though. Regards, Enoch. |
From: Michael K. <mi-...@t-...> - 2013-03-21 22:03:50
|
Hi. What about mnemonic conventions like .s .r .line ." xxx" or key? ?DO and such? Don't we already use such "unwritten laws"? Michael Am 21.03.2013 um 21:24 schrieb Enoch: > Matthias Trute <mt...@we...> writes: > >> Hi Wis, >> >>> It may be a good practice to prefix any "cvariable" name with a >>> mnemonic string (e.g., "c_") to help avoid the troublesome behavior >> >> IIRC it is called Hungarian Notation. I'll add a link >> to the wikipedia article to the recipe. > > But Leo Brodie is defintely not Hungarian :-) > He writes about Choosing Names: The Art > Choose names according to “what,” not “how” > > "But good names are essential for readability. Moreover, the mental > exercise of summoning a one-word description bears a synergistic > effect > on your perceptions of what the entity should or should not do." > > Let's leave the Hungarian method to Microsoft, where it was > invented. It > is an essential evil when managing large projects though. > > Regards, Enoch. > > > ---------------------------------------------------------------------- > -------- > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_mar > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Enoch <ix...@ho...> - 2013-03-21 22:42:44
|
Hello Michael, "Michael Kalus" <mi-...@t-...> writes: > What about mnemonic conventions like > > .s .r .line ." xxx" > > or > > key? ?DO > > and such? Don't we already use such "unwritten laws"? Wis was talking about giving an appropriate name to what cvariable *creates*. There is indeed the Hungarian school of thought which believes that variable name prefixes should immediately reveal the variable type. For example, uiParam "says", I am an unsigned integer parameter. Regards, Enoch. |