00:00:00 --- log: started forth/07.06.23 00:25:15 I have written a forth program! 00:25:22 a short and simple one. 00:25:38 would anyone do me the honour of looking over it and telling me how horrible it is? 00:33:16 --- quit: skas_wk ("I'm outta here.") 00:33:51 url? 00:34:34 is there a pastebin handy? 00:34:50 if not, I can upload it to my website, I guess... 00:34:59 http://forth.pastebin.ca 00:39:44 http://forth.pastebin.ca/585418 00:41:11 forth is pretty different from other languages I'm familiar with, so any words of wisdom you might have is most appreciated. 00:41:25 would be most appreciated 00:58:14 bigger than I thought 00:58:27 I can't test it now, but it looks good 00:58:43 I mean, in terms of style. 00:58:59 you're not forced to use the stack, though. 00:59:13 if I were you I would have used an array to store the lines 00:59:18 okay. 00:59:24 it just seemed easier to use the stack. 00:59:32 ok then 01:00:01 when I finished, it occured to me that if this was part of a larger program, there might be other things on the stack waiting for other words to exit. 01:00:10 is that often the case? 01:00:14 yes. 01:00:40 or is there usually just a few arguments being passed to the next word? 01:00:44 It's unwise to use the stack as a data structure. 01:01:06 so, you'd suggest using an array too, then? 01:01:18 I would, or another suitable structure. 01:01:47 I believe you'll find it lets you write shorter words, better factored. 01:02:16 when I started, I tried using the return stack to store the line I was building, but that really didn't work very well with the loop variables :] 01:02:44 what other suitable structures would there be? 01:02:46 The advice against using the stack as a data structure goes double for the return stack. 01:02:52 yes, so I realised. 01:03:09 I guess I thought forth was essentially a stack machine. 01:03:14 Broadly speaking, the data stack is for parameter passing, the return stack for the occasional temporary. 01:03:57 arcus: no, forth is essentially something else 01:03:59 Forth has stacks; that doesn't mean every problem is to be solved with them and nothing else. 01:04:07 an "unsafe language" 01:04:23 what? what the hell is an 'unsafe language'? 01:04:24 as you can change any position of the memory freely 01:04:58 and you can change the bytecode of your programs, add new control structures, etc 01:05:01 That is not an inherent aspect of the language in any way; it's dependent entirely on the implementation. 01:05:16 true 01:05:19 bah! Forth is not required to be implemented via bytecodes. 01:05:37 Please think, then type, especially when talking to a newcomer. 01:05:40 well, I've stored the address that starts a data structure I'm working on in the return stack, so I can pop it out to the data stack when the word exits, does this seem like a reasonable use of the return stack to you? 01:05:53 arcus, sounds reasonable. 01:07:08 I should devise a way to wave a flag saying "I don't care about ans forth and such modern things" everytime that I say something at #forth :) 01:07:23 okay, the other question I had was about memory management. just before the main word of the program exits, I find the difference between 'here' and the 'here' when I started, then ALLOT negative that much space. 01:07:28 You should devise a way not to make sweeping generalizations that are also false. 01:07:41 arcus, you can do that. 01:09:06 Quartus: I'm not sure about what Forth is anymore. if I take the intersection of all the Forths that I know the result is almost nothing. 01:09:23 are there other strategies I should consider? 01:09:29 arcus, strategies for what? 01:09:37 freeing memory 01:09:55 Well, depends on what you're writing, and what context you expect to run it under. 01:10:10 I mean, given my program, which is just storing lines of pascal's triangle. 01:10:25 I'm allocating using HERE and ALLOT 01:10:41 You might be as well served by a static allocation of memory. Alternatively, Standard systems provide ALLOCATE and FREE, for dynamic memory allocation. 01:11:10 oh, they do? that's good to know. 01:11:38 Yes, allocate/resize/free 01:11:41 would it be worth considering using the pad ? 01:11:56 How much memory do you need? 01:12:08 oh, very little. 01:12:22 Best off just allocating it statically. 01:12:23 I'm just wondering where it would be best to put it. 01:12:39 create mystuff 50 chars allot or what-have-you 01:13:30 Someone wanting to use your code later could always arrange for mystuff to return a different address if required. 01:13:59 well, of course I could calculate how much memory I would need, but I wanted to treat this as though I didn't know exactly how much space I'd need for the resulting structure. 01:14:30 why? 01:15:35 well, if it were a much more complex problem than pascal's triangle, say a simulation of some kind, then I wouldn't know in advance how much memory it would need, necessarily. 01:16:01 --- quit: jns (Read error: 113 (No route to host)) 01:16:08 I suppose, but I'm a pragmatist; I aim to make the solution fit the problem. 01:16:24 well, this is a learning process for me. 01:16:39 You may be overgeneralizing. 01:16:44 I'm not especially interested in generating pascal's triangle for its own sake :] 01:17:25 Looking at your code, I suggest you simplify, factor more tightly, and avoid using the stack as an application-level data structure. 01:17:38 right. 01:17:43 --- join: jns (n=jens@p57B04A7B.dip.t-dialin.net) joined #forth 01:17:50 --- join: ygrek (i=user@gateway/tor/x-c1a3848f32d158f1) joined #forth 01:20:20 The more things you can abstract away, the simpler your code gets. If you name your storage area, you can leave management of it aside, possibly forever; take that clutter right out of your code. 01:21:16 btw, over over is 2dup and drop drop is 2drop 01:21:32 huh, I was wondering about that. 01:21:54 I saw 'over over' in Beginning Forth 01:22:05 and wondered why they didn't use 2dup. 01:22:16 I can't think of any circumstance where over over would clarify things 01:22:27 I thought maybe you used 2dup only for double-precision numbers. 01:22:39 no, it duplicates the top two stack items, no matter what they are. 01:23:01 okay. thanks. 01:23:34 create mystuff 50 chars alot creates a global binding, does it not? 01:23:46 by which you mean... 01:24:15 the word 'mystuff' is visible to the whole forth environment 01:24:22 As are all the words you define. 01:26:27 doesn't the namespace get awfully cluttered? 01:27:27 If you carry on with Forth, there are ways to scope your names, but perhaps it's unnecessary to worry about it at this stage. 01:28:34 so, the practice would be, create some memory space, and let the wider program worry about freeing it if necessary ? 01:28:57 Namespace management is a non-issue in practical terms. As I said, there are ways of managing it that you can find out about in time. 01:29:00 if my code was being used in a larger program say. 01:30:05 I'd leave the whole issue of whether or not your code will ever be integrated into another program as a bridge to be crossed when you come to it. I advise against bending over backward to accomodate imaginary future requirements. 01:30:44 Early days are the time to work on factoring: good naming, short words, keeping the working stack down to three or four items at most. 01:32:24 okay. I guess I'm just wondering about how one manages memory in forth. But perhaps I'm getting ahead of myself. 01:32:41 In the broadest terms, it's done with allocate/resize/free 01:33:11 But it's not worth worrying about now 01:34:15 okay. so you don't use allot so much. is allocating in the dictionary space more a historical practice ? 01:34:40 Dynamically doing so is less common in systems that have more flexible alternatives. 01:35:43 allot still gets regular use for static data structures 01:36:37 why would flexible alternatives not be available? is that just forth system design, or is maybe a hardware restriction sometimes? 01:38:06 allocate/resize/free are most commonly found on Forths that run on an OS; they're just hooks to the OS's memory functions. 01:38:07 OK, I really need to go eat before I fall over. 01:38:24 thank you very much for your remarks, they've been most helpful. 01:38:38 Ok. Come back anytime. 01:55:11 oh, that was the other thing I wanted to ask. I'm using gforth at the moment, which is a pretty arbitrary choice on my part. 01:55:25 is that an OK implementation to use, or should I consider another? 01:55:34 Yes, it's a good system for learning on. 01:56:23 and bigForth ? That was the other one I was considering, mainly because it claims to have a GUI. 01:56:43 Linux? 01:56:49 yeah. 01:57:05 I don't know bigForth particularly well. Is it still being maintained? 01:57:10 seems to be. 01:57:15 last release was in may. 01:57:24 documentation seems rather out of date, though. 01:58:44 For learning the language, Gforth is a good choice. 01:59:36 okay. 02:00:45 It's standard, works well, and is quite stable. 02:02:34 --- quit: yumehito (Remote closed the connection) 02:02:52 --- join: yumehito (n=yumehito@b-internet.87.103.254.70.snt.ru) joined #forth 02:03:53 --- join: skas_wk (n=skas@202-90-54-135.static.linearg.net) joined #forth 03:36:27 --- join: ygrek_ (i=user@gateway/tor/x-f3ed1f2cc7d3b8ab) joined #forth 03:38:22 --- quit: ygrek (Remote closed the connection) 03:39:21 --- quit: skas_wk (Remote closed the connection) 03:45:05 --- join: yumehito_ (n=yumehito@b-internet.87.103.254.70.snt.ru) joined #forth 03:51:55 --- join: skas_wk (n=skas@202-90-54-135.static.linearg.net) joined #forth 03:52:34 --- quit: yumehito (Read error: 110 (Connection timed out)) 04:07:07 --- quit: edrx (Remote closed the connection) 04:20:19 --- quit: jns (Read error: 113 (No route to host)) 04:37:10 --- quit: madgarden (Read error: 110 (Connection timed out)) 05:24:05 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 05:38:11 morning all 05:39:45 --- quit: pierpa (Read error: 113 (No route to host)) 05:45:20 --- join: JasonWoo1 (n=jason@c-71-192-30-169.hsd1.ma.comcast.net) joined #forth 05:51:33 --- quit: JasonWoof (Nick collision from services.) 05:51:39 --- nick: JasonWoo1 -> JasonWoof 05:51:44 --- mode: ChanServ set +o JasonWoof 06:11:14 --- quit: arcus ("Ex-Chat") 06:32:43 --- join: yumehito (n=yumehito@b-internet.87.103.254.70.snt.ru) joined #forth 06:45:28 --- quit: yumehito_ (Read error: 110 (Connection timed out)) 07:12:50 t/close 07:12:52 --- quit: skas_wk ("I'm outta here.") 07:13:53 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 07:20:00 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 07:20:38 hey JasonWoof 07:21:03 hi :) 07:25:22 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 08:10:30 --- quit: gnomon ("!") 08:10:59 --- join: gnomon (n=gnomon@CPE0050eb372bdb-CM001692f57b56.cpe.net.cable.rogers.com) joined #forth 08:11:19 --- quit: gnomon (Client Quit) 08:12:25 --- join: gnomon (n=gnomon@CPE0050eb372bdb-CM001692f57b56.cpe.net.cable.rogers.com) joined #forth 08:20:46 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 08:35:42 --- join: nighty^ (n=nighty@sushi.rural-networks.com) joined #forth 08:46:57 --- quit: yumehito (Connection timed out) 08:47:19 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 08:50:35 --- quit: ygrek_ (Remote closed the connection) 08:57:51 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 09:03:08 --- join: ygrek (i=user@gateway/tor/x-d90f5e46593d516d) joined #forth 09:06:47 --- join: yumehito (n=yumehito@b-internet.87.103.254.70.snt.ru) joined #forth 10:06:21 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 10:08:35 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 10:17:25 good afternoon 10:24:52 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 10:27:12 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 10:36:27 hi crc 10:36:35 hi Quartus 10:37:20 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 10:40:31 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 12:12:41 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 12:13:48 --- join: ecraven (i=nex@eutyche.swe.uni-linz.ac.at) joined #forth 12:23:32 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 12:24:58 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 12:26:07 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 12:51:57 --- join: nighty^^ (n=nighty@sushi.rural-networks.com) joined #forth 13:05:36 --- quit: nighty^ (Read error: 113 (No route to host)) 13:18:07 --- join: Tomasso (n=tomasso@197-187-126-200.fibertel.com.ar) joined #forth 13:30:46 --- quit: Tomasso ("Leaving") 14:02:23 --- quit: ygrek (Remote closed the connection) 14:16:24 --- join: slava (n=slava@CPE0080ad77a020-CM000e5cdfda14.cpe.net.cable.rogers.com) joined #forth 14:16:25 --- mode: ChanServ set +o slava 14:30:40 --- quit: ecraven ("bbl") 15:01:56 --- join: crest_ (n=crest@p5489E36B.dip.t-dialin.net) joined #forth 15:18:39 --- quit: Crest (Read error: 110 (Connection timed out)) 16:17:59 --- quit: slava () 17:26:35 --- nick: crest_ -> Crest 18:22:14 --- join: skas_wk (n=skas@121.127.198.32) joined #forth 18:37:07 --- join: snoopy_1711 (i=snoopy_1@dslb-084-058-137-173.pools.arcor-ip.net) joined #forth 18:49:16 --- join: segher_ (n=segher@dslb-084-056-171-232.pools.arcor-ip.net) joined #forth 18:54:48 --- quit: Snoopy42 (Read error: 110 (Connection timed out)) 18:54:59 --- nick: snoopy_1711 -> Snoopy42 18:55:29 --- join: arcus (n=ajt@121-73-23-172.cable.telstraclear.net) joined #forth 18:58:12 --- quit: segher__ (Read error: 110 (Connection timed out)) 19:18:48 --- join: edrx (i=edrx@201.5.13.117) joined #forth 19:50:56 hey 19:52:31 hey 19:52:52 --- join: Renardp (n=chatzill@modemcable239.187-131-66.mc.videotron.ca) joined #forth 19:53:40 hi, there is any connection between forth and fortran ? 19:55:45 No. 19:56:35 thanks 19:56:45 --- part: Renardp left #forth 19:56:57 they both start with 'fort' ... 19:58:34 http://galileo.phys.virginia.edu/classes/551.jvn.fall01/ftran202.htm 19:58:54 Well, a postfix translator does not a Fortran make 19:59:48 True enough, but that code seems to have worked well enough for the late Dr. Noble. 20:00:00 For formula translation only. 20:00:16 I make frequent use of Wil Baden's OPG, similar animal. 20:47:40 --- quit: nighty^^ (Remote closed the connection) 21:24:44 --- quit: skas_wk ("I'm outta here.") 21:26:59 --- join: skas_wk (n=skas@121.127.198.32) joined #forth 21:28:25 --- part: arcus left #forth 21:33:18 --- quit: Raystm2 ("I've embarrassed my self enough for one day.") 21:33:52 --- part: RayS left #forth 21:54:35 --- join: Raystm2 (n=NanRay@adsl-68-95-161-155.dsl.rcsntx.swbell.net) joined #forth 21:55:16 --- join: RayS (n=Ray_stma@adsl-68-95-161-155.dsl.rcsntx.swbell.net) joined #forth 22:02:56 --- join: DocPlatypus (n=skquinn@cpe-67-10-176-4.houston.res.rr.com) joined #forth 22:22:47 --- quit: skas_wk ("I'm outta here.") 23:43:47 --- quit: tgunr (Read error: 104 (Connection reset by peer)) 23:44:57 --- join: tgunr (n=davec@72-173-44-78.cust.wildblue.net) joined #forth 23:59:59 --- log: ended forth/07.06.23