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


Groups > comp.lang.forth > #9523 > unrolled thread

Adding thousands separators

Started by"Ed" <nospam@invalid.com>
First post2012-02-13 21:24 +1100
Last post2012-03-01 18:52 +0000
Articles 20 on this page of 141 — 26 participants

Back to article view | Back to comp.lang.forth


Contents

  Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-13 21:24 +1100
    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-13 13:05 -0800
      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-16 10:19 +1100
    Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-15 08:48 +0100
      Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-23 22:46 -0800
        Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-24 08:07 +0100
        Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-24 15:00 +0100
          Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-24 08:29 -1000
            Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-25 00:11 +0100
          Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-27 23:28 -0800
            Re: Adding thousands separators Alex McDonald <blog@rivadpm.com> - 2012-02-28 01:37 -0800
              Re: Adding thousands separators Ron Aaron <rambamist@gmail.com> - 2012-02-28 15:06 +0200
            Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-02-29 09:29 +0100
              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-29 03:00 -0600
                Re: Adding thousands separators The Beez <the.beez.speaks@gmail.com> - 2012-02-29 03:44 -0800
                  Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-29 11:19 -0600
              Re: Adding thousands separators hughaguilar96@yahoo.com - 2012-02-29 22:48 -0800
                Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-01 08:38 +0100
                  Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-01 00:57 -0800
                    Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-01 18:23 +0100
                    Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-01 17:22 -0800
                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-01 18:00 -0800
                        Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-01 22:14 -0800
                          Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 06:58 -0800
                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-02 11:07 -0800
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-02 13:13 -0600
                              Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 11:25 -0800
                                Re: Adding thousands separators Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-03 11:00 +0000
                                  Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 03:17 -0800
                                    Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-03 12:30 +0000
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 11:39 -0800
                                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-06 16:31 -0800
                                    Re: Adding thousands separators mhx@iae.nl (Marcel Hendrix) - 2012-03-03 15:52 +0200
                                      Re: Adding thousands separators Coos Haak <chforth@hccnet.nl> - 2012-03-03 16:23 +0100
                                      Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 10:19 -0800
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 12:35 -0800
                                    Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 11:02 -0600
                                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-03 17:25 +0000
                                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 10:14 -0800
                                          Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 14:14 -0600
                                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 14:52 -0800
                                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-04 03:39 -0600
                                          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 15:02 +0000
                                        Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-03 14:11 -0600
                                      Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-03 23:49 +0100
                                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-03 15:50 -0800
                                        Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 15:38 +0000
                                          Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-04 18:08 +0100
                                            Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-04 11:20 -0600
                                            Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-04 17:45 +0000
                                              Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-04 23:50 +0100
                                                Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-05 14:39 +0000
                                          Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-03-06 13:01 -0800
                                            Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:05 +0000
                                    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-03 15:45 -0800
                                      Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 17:56 -0800
                                        Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-05 15:41 -0800
                                          Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-06 11:27 -0800
                                  Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-03 11:01 -0800
                        Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-02 05:53 -0800
                      Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-03 01:49 +0100
        Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-29 17:20 +1100
          Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-29 07:51 +0100
          Re: Adding thousands separators hughaguilar96@yahoo.com - 2012-02-29 21:26 -0800
            Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-03 03:45 +0000
            Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 20:49 +1100
              Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-04 15:16 +0100
                Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:06 +1100
                  Re: Adding thousands separators Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-06 08:32 +0100
              Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-05 15:06 -0800
                Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:03 +1100
                Re: Adding thousands separators hwfwguy@gmail.com - 2012-03-06 20:29 -0800
                  Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-06 23:18 -0800
                    Re: Adding thousands separators John Passaniti <john.passaniti@gmail.com> - 2012-03-07 06:07 -0800
                    Re: Adding thousands separators hwfwguy@gmail.com - 2012-03-07 06:36 -0800
                      Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-07 16:19 -0800
                        Re: Adding thousands separators Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-08 10:51 +0000
    Re: Adding thousands separators Doug Hoffman <glidedog@gmail.com> - 2012-02-15 20:18 -0500
      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-17 12:29 +1100
        Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-17 09:42 -0800
          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-20 15:24 +0000
            Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-20 20:41 -0800
              Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-21 16:46 +0000
                Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-21 12:23 -0600
                  Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-21 11:32 -0800
                    Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-22 12:46 +1100
                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 10:08 +0000
                        Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-22 08:51 -1000
                          Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 14:28 -0800
                          Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-23 13:13 +0000
                          Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-24 14:32 +1100
                            Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-23 19:53 -1000
                              Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-03 12:47 +1100
                                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-02 22:26 -0800
                                  Re: Adding thousands separators Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2012-03-03 14:32 +0000
                                  Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 21:31 +1100
                                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-04 10:07 -0800
                                      Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-06 15:31 +1100
                                        Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-03-05 22:26 -0800
                                        Re: Adding thousands separators Josh Grams <josh@qualdan.com> - 2012-03-06 12:32 +0000
                            Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-24 05:04 -0800
                              Re: Adding thousands separators "Elizabeth D. Rather" <erather@forth.com> - 2012-02-24 08:30 -1000
                      Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-22 04:28 -0600
                        Re: Adding thousands separators stephenXXX@mpeforth.com (Stephen Pelc) - 2012-02-22 14:59 +0000
                          Re: Adding thousands separators stephenXXX@mpeforth.com (Stephen Pelc) - 2012-02-22 18:05 +0000
                      Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 07:49 -0800
                        Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-22 12:46 -0800
                          Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 18:24 -0800
                        Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-24 13:23 +1100
                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-21 11:29 -0800
                  Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 09:56 +0000
                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-22 07:37 -0800
                      Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-22 10:30 -0600
                      Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-22 16:24 +0000
                      Re: Adding thousands separators Brad <hwfwguy@gmail.com> - 2012-02-23 07:44 -0800
                        Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-02-23 17:54 +0100
                        Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-23 16:51 +0000
                          Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-23 11:49 -0600
                            Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-23 13:26 -0800
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-23 15:58 -0600
                            Re: Adding thousands separators Bernd Paysan <bernd.paysan@gmx.de> - 2012-02-26 02:25 +0100
                              Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-26 03:24 -0600
                                Re: Adding thousands separators anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-26 13:40 +0000
                                  Re: Adding thousands separators Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-02-26 11:06 -0600
                    Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-23 15:02 -0800
    Re: Adding thousands separators Doug Hoffman <glidedog@gmail.com> - 2012-02-16 13:21 -0500
    Re: Adding thousands separators Paul Rubin <no.email@nospam.invalid> - 2012-02-16 20:44 -0800
      Re: Adding thousands separators Coos Haak <chforth@hccnet.nl> - 2012-02-17 21:32 +0100
    Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-17 22:41 +0100
      Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-17 18:52 -0800
        Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-18 10:39 +0100
          Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-02-18 21:22 +1100
            Re: Adding thousands separators "A. K." <akk@nospam.org> - 2012-02-18 13:12 +0100
              Re: Adding thousands separators "Peter Knaggs" <pjk@bcs.org.uk> - 2012-02-18 16:30 +0000
                Re: Adding thousands separators Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2012-02-18 17:08 +0000
                Re: Adding thousands separators BruceMcF <agila61@netscape.net> - 2012-02-18 14:46 -0800
              Re: Adding thousands separators "Ed" <nospam@invalid.com> - 2012-03-04 20:47 +1100
    Re: Adding thousands separators Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-02-28 17:03 -0800
    Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-01 18:13 +0000
      Re: Adding thousands separators Alex McDonald <blog@rivadpm.com> - 2012-03-01 12:46 -0800
    Re: Adding thousands separators "WJ" <w_a_x_man@yahoo.com> - 2012-03-01 18:52 +0000

Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →


#9778

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-03-01 17:22 -0800
Message-ID<8fac08fb-8df6-43b3-878b-ecbee0bfd74e@s7g2000vby.googlegroups.com>
In reply to#9767
Responding to this specific point:

On Mar 1, 3:57 am, Hugh Aguilar <hughaguila...@yahoo.com> wrote:
> What I have is not as powerful as OOP, but it is extremely
> fast executing. I don't have any of the housekeeping that
> is normally involved in OOP (especially polymorphism), but
> I have inheritance which is the important aspect of OOP. In
> my experience, most programs don't need polymorphism or any
> of that other stuff --- what I provide is adequate for even
> large programs. [...]

Back in the early 80's, most people will remember when OOP started to
go mainstream.  C++ wasn't the first object-oriented language and
certainly wasn't the best, but for many it was the first practical
one.  Regardless, for those who remember those days, you'll also
remember that they were inheritance happy.  Every major class library
from that time took on the Smalltalk model of having a single mother
object that everything descended from.  And why not?  After all, it
worked well in Smalltalk, so why wouldn't it work well for C++?

A few years pass and people start to understand that inheritance is a
pretty blunt tool.  For starters, you don't always want to inherit
*everything* in a base class.  So you often had to do things like
create completely artificial classes that didn't represent anything
useful, but served only to serve as a base for when you didn't want to
include something.  That sometimes led to goofy class hierarchies that
didn't feel natural.  You could sometimes solve these problems with
multiple inheritance, but that brings it's own set of problems.

So what happened in C++ (and what has happened in a bunch of other
class-based object-oriented languages) is that inheritance isn't as
much a big deal as it once was.  Obviously it solves some problems
very well and serves as a way to factor out both code and data
nicely.  But it can lead to force-fitting a problem into an unnatural
class hierarchy.  Far more often, other techniques like traits,
interfaces, delegates, are becoming more popular, because they are
finer-grained than inheritance.

As far as polymorphism, if you aren't using polymorphism much, then
you probably aren't doing OOP, or at least you aren't using it
effectively.  The primary value of polymorphism is to treat members of
some hierarchy in a consistent way.  So if as you say you are using
inheritance but aren't using polymorphism, then that suggests that
your use of inheritance is mostly limited to extending data
structures.  That's a pretty low-level use of OOP, but hey, I know a C+
+ programmer who thinks he's doing OOP because instead of "struct"
he's using "class".

For most everyone else, polymorphism is perhaps the key feature of OOP
that people value.  It's the feature that makes inheritance useful
beyond just simple aggregation of data.  It's the feature that lets
you treat subtypes consistently and without having to resort to
control structures that dispatch based on type.  It's pretty
fundamental.  I can easily imagine object oriented programming without
(strict) encapsulation and without inheritance.  I can't imagine
object-oriented programming without polymorphism in some form.  If you
can, I'd really enjoy hearing how you define object-oriented because
it's completely outside any definition I'm aware of.

[toc] | [prev] | [next] | [standalone]


#9779

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-01 18:00 -0800
Message-ID<7xzkbzvk1i.fsf@ruckus.brouhaha.com>
In reply to#9778
John Passaniti <john.passaniti@gmail.com> writes:
> I'd really enjoy hearing how you define object-oriented because
> it's completely outside any definition I'm aware of.

http://en.wikipedia.org/wiki/Object-oriented_programming#Criticism

has some nice descriptions too ;-).

[toc] | [prev] | [next] | [standalone]


#9780

FromHugh Aguilar <hughaguilar96@yahoo.com>
Date2012-03-01 22:14 -0800
Message-ID<587aa661-fcb0-48f4-b3a2-c63c5cffcf98@c21g2000yqi.googlegroups.com>
In reply to#9779
On Mar 1, 7:00 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
> John Passaniti <john.passan...@gmail.com> writes:
> > I'd really enjoy hearing how you define object-oriented because
> > it's completely outside any definition I'm aware of.
>
> http://en.wikipedia.org/wiki/Object-oriented_programming#Criticism
>
> has some nice descriptions too ;-).

The primary feature of my Straight Forth that I am writing, will be
closures. For the most part, I am getting rid of all of the cruft in
ANS-Forth (DO loops, etc.). The primary new thing that I am adding is
closures.

I will not provide OOP beyond the level that I provided already in my
novice package. ALLOCATION will be standardized, but that is all.

[toc] | [prev] | [next] | [standalone]


#9783

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-03-02 06:58 -0800
Message-ID<121fa70d-d1c2-42cf-9c53-f2f7f8668f9f@w5g2000vbv.googlegroups.com>
In reply to#9780
On Mar 2, 1:14 am, Hugh Aguilar <hughaguila...@yahoo.com> wrote:
> The primary feature of my Straight Forth that I am writing,
> will be closures. For the most part, I am getting rid of
> all of the cruft in ANS-Forth (DO loops, etc.). The primary
> new thing that I am adding is closures.

I hope you aren't confusing closures with anonymous functions.  I'd
enjoy seeing the most common and useful form of closures (lexically
scoped, can be passed as first-class data, and existing with an
lifetime independent from their creation) in a Forth.  Anything less
is likely going to be painful to use.

> I will not provide OOP beyond the level that I provided
> already in my novice package. ALLOCATION will be
> standardized, but that is all.

If you implement closures well, they can be used to create a different
form of objects.

[toc] | [prev] | [next] | [standalone]


#9785

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-02 11:07 -0800
Message-ID<7x4nu695yy.fsf@ruckus.brouhaha.com>
In reply to#9783
John Passaniti <john.passaniti@gmail.com> writes:
> I hope you aren't confusing closures with anonymous functions.  I'd
> enjoy seeing the most common and useful form of closures (lexically
> scoped, can be passed as first-class data, and existing with an
> lifetime independent from their creation) in a Forth.  Anything less
> is likely going to be painful to use.

Having lexical closures with no garbage collection sounds painful in its
own right.

[toc] | [prev] | [next] | [standalone]


#9786

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-02 13:13 -0600
Message-ID<yIqdnbxMLMhrhszSnZ2dnUVZ_gqdnZ2d@supernews.com>
In reply to#9785
Paul Rubin <no.email@nospam.invalid> wrote:
> John Passaniti <john.passaniti@gmail.com> writes:
>> I hope you aren't confusing closures with anonymous functions.  I'd
>> enjoy seeing the most common and useful form of closures (lexically
>> scoped, can be passed as first-class data, and existing with an
>> lifetime independent from their creation) in a Forth.  Anything less
>> is likely going to be painful to use.
> 
> Having lexical closures with no garbage collection sounds painful in its
> own right.

Yes.  As discussed recently at some length.  :-)

Andrew.

[toc] | [prev] | [next] | [standalone]


#9787

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-03-02 11:25 -0800
Message-ID<be715108-58e0-4ea8-a7e7-71ebfc9bfb55@l1g2000vbc.googlegroups.com>
In reply to#9785
On Mar 2, 2:07 pm, Paul Rubin <no.em...@nospam.invalid> wrote:
> Having lexical closures with no garbage collection sounds
> painful in its own right.

Yep.  The moment you have the ability to create a lexically-scoped
closure and freely pass it around, you have something that can outlive
the activation it occurred in.  Some form of garbage collection is
needed.  When I've brought this up in comp.lang.forth in the past, the
usual knee-jerk reaction is "gosh, you can do that manually, it isn't
that hard."  Well, yeah, and you can mix broken glass in your morning
breakfast too for added crunch.

Regardless, I look forward to seeing whatever it is Hugh thinks a
closure is.

[toc] | [prev] | [next] | [standalone]


#9800

FromAlbert van der Horst <albert@spenarnc.xs4all.nl>
Date2012-03-03 11:00 +0000
Message-ID<m0b2km.hm2@spenarnc.xs4all.nl>
In reply to#9787
In article <be715108-58e0-4ea8-a7e7-71ebfc9bfb55@l1g2000vbc.googlegroups.com>,
John Passaniti  <john.passaniti@gmail.com> wrote:
>On Mar 2, 2:07=A0pm, Paul Rubin <no.em...@nospam.invalid> wrote:
>> Having lexical closures with no garbage collection sounds
>> painful in its own right.
>
>Yep.  The moment you have the ability to create a lexically-scoped
>closure and freely pass it around, you have something that can outlive
>the activation it occurred in.  Some form of garbage collection is
>needed.  When I've brought this up in comp.lang.forth in the past, the
>usual knee-jerk reaction is "gosh, you can do that manually, it isn't
>that hard."  Well, yeah, and you can mix broken glass in your morning
>breakfast too for added crunch.

I don't agree. With 4Gbyte of internal memory in my Forth, a large
class of problems can be solved with closures, that ly around
indefinitely. Don't even try to collect them manually.

>
>Regardless, I look forward to seeing whatever it is Hugh thinks a
>closure is.

Me too. I hope he leaves the garbage collection out, as that diminishes
the chance we'll ever see something from it.

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#9801

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-03 03:17 -0800
Message-ID<7xaa3y2at9.fsf@ruckus.brouhaha.com>
In reply to#9800
Albert van der Horst <albert@spenarnc.xs4all.nl> writes:
> I don't agree. With 4Gbyte of internal memory in my Forth, a large
> class of problems can be solved with closures, that ly around
> indefinitely. Don't even try to collect them manually.

1) I think the typical system where Forth is used has nowhere near 4G of
memory.

2) If you program in a style that uses closures a lot, burning through
4G won't take very long anyway. 

> Me too. I hope he leaves the garbage collection out, as that diminishes
> the chance we'll ever see something from it.

GC isn't that hard to implement, but I think it's not in the Forth
spirit to rely on it heavily.  Forth as I see it is about very manual
control of almost everything, stingy use of memory, and deterministic
scheduling suitable for hard-real-time applications.

I'd say if you want a language with closures and GC, you actually want
Lisp rather than Forth, so it's better to just implement Lisp directly.

[toc] | [prev] | [next] | [standalone]


#9803

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-03 12:30 +0000
Message-ID<2012Mar3.133023@mips.complang.tuwien.ac.at>
In reply to#9801
Paul Rubin <no.email@nospam.invalid> writes:
>2) If you program in a style that uses closures a lot, burning through
>4G won't take very long anyway. 

You might be surprised.  The S/K/ID paper [belinfante87] does
something like closures, but with combinators, and did not
garbage-collect unreachable combinators.  I played around with it on a
C64, where I had maybe 30KB of free memory after the Forth system was
loaded.  I expected to run out of memory very fast and was surprised
how far I got before that happened.

In a similar vein, the Gray parser generator generates sets in memory,
some of which are not needed later; I did not try to reclaim the
memory they use, but I measured the amount of memory used for sets for
a relativly large grammar (the Oberon grammar).  The amount of space
used was 5719 bytes, and only a part of that was not needed.  Trying
to reclaim the memory would have probably cost more memory than it
would have reclaimed.

@string(jfar="Journal of Forth Application and Research")
@Article{belinfante87,
  author = 	 "Johan G.F. Belinfante",
  title = 	 "S/K/ID: Combinators in Forth",
  journal =	 jfar,
  year =	 "1987",
  volume =	 "4",
  number =	 "4",
  pages =	 "555--580"
}

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9814

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-03-03 11:39 -0800
Message-ID<fd0ee194-5c27-4359-a336-21da2fa19a99@l1g2000vbc.googlegroups.com>
In reply to#9803
On Mar 3, 7:30 am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
wrote:
> You might be surprised.  The S/K/ID paper [belinfante87]
> does something like closures, but with combinators, and
> did not garbage-collect unreachable combinators.  I
> played around with it on a C64, where I had maybe 30KB
> of free memory after the Forth system was loaded.  I
> expected to run out of memory very fast and was surprised
> how far I got before that happened.

It's not at all surprising that specific applications using specific
programming techniques in specific programming languages can generate
different amounts of reclaimable memory.  Such examples are likely
some combination of not typical, not realistic, and/or not idiomatic.
In languages that support garbage collection, idiomatic use of the
language in real-world applications will tend to produce plenty of
opportunities to reclaim memory.

[toc] | [prev] | [next] | [standalone]


#9900

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-06 16:31 -0800
Message-ID<7xhay1xnds.fsf@ruckus.brouhaha.com>
In reply to#9803
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>>2) If you program in a style that uses closures a lot, burning through
>>4G won't take very long anyway. 
>
> You might be surprised.  The S/K/ID paper ... I played around with it
> on a C64, where I had maybe 30KB of free memory after the Forth system
> was loaded.  I expected to run out of memory very fast and was
> surprised how far I got before that happened.

Maybe it's a matter of coding and code generation style.  I worked on a
Lisp interpreter with a mark/sweep gc and it was careful to
stack-allocate a lot of things when it was safe to do so.  That
decreased by quite a bit the amount of stuff ever allocated in the heap.
Other systems with copying GC's allocate stuff in the heap much more
profigately, relying on the GC to run fast and keep the live data tidy.

[toc] | [prev] | [next] | [standalone]


#9805

Frommhx@iae.nl (Marcel Hendrix)
Date2012-03-03 15:52 +0200
Message-ID<09838800008435@frunobulax.edu>
In reply to#9801
Paul Rubin <no.email@nospam.invalid> wrote: Re: Adding thousands separators

> Albert van der Horst <albert@spenarnc.xs4all.nl> writes:
>> I don't agree. With 4Gbyte of internal memory in my Forth, a large
>> class of problems can be solved with closures, that ly around
>> indefinitely. Don't even try to collect them manually.
[..]
> GC isn't that hard to implement, but I think it's not in the Forth
> spirit to rely on it heavily.  Forth as I see it is about very manual
> control of almost everything, stingy use of memory, and deterministic
> scheduling suitable for hard-real-time applications.

> I'd say if you want a language with closures and GC, you actually want
> Lisp rather than Forth, so it's better to just implement Lisp directly.

What (more) do we need for a useful closure?

-marcel

-- ---------
0 [IF]
 Python closure ( http://en.wikipedia.org/wiki/Closure_(computer_science)#Example )

	def counter():
	    x = 0
	    def increment(y):
		nonlocal x
		x += y
		print(x)
	    return increment

	counter1_increment = counter()
	counter2_increment = counter()

	counter1_increment(1)              # prints 1
	counter1_increment(7)              # prints 8
	counter2_increment(1)              # prints 1
	counter1_increment(1)              # prints 9
[THEN]

: closure: 
	CREATE  ( "name" -- )
	  	CELL ALLOCATE THROW ,
( \ )	FORGET>	@ FREE ?ALLOCATE
	DOES>   ( y -- ) 
		@ LOCALS| x |
		x +!  
		CR ." x = " x @ . ; 

closure: counter1_increment
closure: counter2_increment

	1 counter1_increment \ prints 1
	7 counter1_increment \ prints 8
	1 counter2_increment \ prints 1
	1 counter1_increment \ prints 9

[toc] | [prev] | [next] | [standalone]


#9807

FromCoos Haak <chforth@hccnet.nl>
Date2012-03-03 16:23 +0100
Message-ID<16nklwyp12gdw.14z53hwfq59hz.dlg@40tude.net>
In reply to#9805
Op Sat, 3 Mar 2012 15:52:26 +0200 schreef Marcel Hendrix:

> Paul Rubin <no.email@nospam.invalid> wrote: Re: Adding thousands separators
> 
>> Albert van der Horst <albert@spenarnc.xs4all.nl> writes:
>>> I don't agree. With 4Gbyte of internal memory in my Forth, a large
>>> class of problems can be solved with closures, that ly around
>>> indefinitely. Don't even try to collect them manually.
> [..]
>> GC isn't that hard to implement, but I think it's not in the Forth
>> spirit to rely on it heavily.  Forth as I see it is about very manual
>> control of almost everything, stingy use of memory, and deterministic
>> scheduling suitable for hard-real-time applications.
> 
>> I'd say if you want a language with closures and GC, you actually want
>> Lisp rather than Forth, so it's better to just implement Lisp directly.
> 
> What (more) do we need for a useful closure?
> 
> -marcel
> 
> -- ---------
> 0 [IF]
>  Python closure ( http://en.wikipedia.org/wiki/Closure_(computer_science)#Example )
> 
> 	def counter():
> 	    x = 0
> 	    def increment(y):
> 		nonlocal x
> 		x += y
> 		print(x)
> 	    return increment
> 
> 	counter1_increment = counter()
> 	counter2_increment = counter()
> 
> 	counter1_increment(1)              # prints 1
> 	counter1_increment(7)              # prints 8
> 	counter2_increment(1)              # prints 1
> 	counter1_increment(1)              # prints 9
> [THEN]
> 
>: closure: 
> 	CREATE  ( "name" -- )
> 	  	CELL ALLOCATE THROW ,
> ( \ )	FORGET>	@ FREE ?ALLOCATE
> 	DOES>   ( y -- ) 
> 		@ LOCALS| x |
> 		x +!  
> 		CR ." x = " x @ . ; 
> 
> closure: counter1_increment
> closure: counter2_increment
> 
> 	1 counter1_increment \ prints 1
> 	7 counter1_increment \ prints 8
> 	1 counter2_increment \ prints 1
> 	1 counter1_increment \ prints 9

After modifying the code, my FORGET> must be after DOES>, it works.
But after forgetting and reloading, the values of x are somewhat off.
ALLOCATE does not initialize its memory to zero by default.

-- 
Coos

CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html 

[toc] | [prev] | [next] | [standalone]


#9811

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-03 10:19 -0800
Message-ID<7xaa3xwnrj.fsf@ruckus.brouhaha.com>
In reply to#9805
mhx@iae.nl (Marcel Hendrix) writes:
> What (more) do we need for a useful closure?
> : closure: 
> 	CREATE  ( "name" -- ) ...

I don't think that's a real closure, in that it absorbs a source token
and makes a dictionary entry.  You have to be able to make them on the
fly, for example if you want an array of them.  Closures have to be able
to create and return other closures, and so on.

[toc] | [prev] | [next] | [standalone]


#9817

FromJohn Passaniti <john.passaniti@gmail.com>
Date2012-03-03 12:35 -0800
Message-ID<f3fc7177-5563-47cb-8b3a-f50348f0f94b@gw9g2000vbb.googlegroups.com>
In reply to#9805
On Mar 3, 8:52 am, m...@iae.nl (Marcel Hendrix) wrote:
> What (more) do we need for a useful closure?

The ability to create zillions of these and then later destroy them in
random order over the course of some program.  You're creating these
as dictionary entries.  How many Forth systems have dictionaries that
would allow that?  I might use closures to represent things like
events coming in a system or the context for a network connection or
objects (in the OOP sense), all with statically-unpredictable
lifetimes.

More importantly, you had to design the "closure:" word specifically.
You always allocate one cell for the environment, you always call that
cell x.  In languages with lexically-scoped closures, the programmer
does nothing more than reference the variables they wanted in the
environment and the language does the right thing.  No, that's not the
Forth Way<tm>.  The Forth Way<tm> is to ignore the qualities of the
larger feature that make it useful and practical and instead implement
a trivial, highly specific, and uninteresting case.

[toc] | [prev] | [next] | [standalone]


#9808

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-03 11:02 -0600
Message-ID<LuGdnfHKuO0W08_SnZ2dnUVZ_oOdnZ2d@supernews.com>
In reply to#9801
Paul Rubin <no.email@nospam.invalid> wrote:
> Albert van der Horst <albert@spenarnc.xs4all.nl> writes:
>> I don't agree. With 4Gbyte of internal memory in my Forth, a large
>> class of problems can be solved with closures, that ly around
>> indefinitely. Don't even try to collect them manually.
> 
> 1) I think the typical system where Forth is used has nowhere near 4G of
> memory.
> 
> 2) If you program in a style that uses closures a lot, burning through
> 4G won't take very long anyway. 
> 
>> Me too. I hope he leaves the garbage collection out, as that diminishes
>> the chance we'll ever see something from it.
> 
> GC isn't that hard to implement, but I think it's not in the Forth
> spirit to rely on it heavily.  Forth as I see it is about very manual
> control of almost everything, stingy use of memory, and deterministic
> scheduling suitable for hard-real-time applications.

True, but there's nothing to stop you from doing GC in a fairly low-
level way.  I think it might be very nice fit if done well.  I suppose
to do a nice job it'd help to make the virtual machine aware of the
GC, but it needn't be necessary.  It depends on just how much of the
system you use GC for.

WRT deterministic scheduling, dynamic memory allocation doesn't have
to be on the critical path of the hard real-time part of the
application.  When I did Forth full-time (mostly in industrial control
applications) I was terrified of GC and knew that it wasn't
appropriate.  Now that I understand GC better I think that I was
mistaken, and it would have been useful.  I might be wrong about that.
;-)

Andrew.

[toc] | [prev] | [next] | [standalone]


#9809

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-03 17:25 +0000
Message-ID<2012Mar3.182509@mips.complang.tuwien.ac.at>
In reply to#9808
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>True, but there's nothing to stop you from doing GC in a fairly low-
>level way.  I think it might be very nice fit if done well.  I suppose
>to do a nice job it'd help to make the virtual machine aware of the
>GC, but it needn't be necessary.  It depends on just how much of the
>system you use GC for.

Hmm, maybe the problem with Forth and libraries is not that they don't
exist, but that the community ignores them.  GC for Forth has existed
for at least 12 years.

http://www.complang.tuwien.ac.at/forth/garbage-collection.zip

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9810

FromPaul Rubin <no.email@nospam.invalid>
Date2012-03-03 10:14 -0800
Message-ID<7xeht9wo0a.fsf@ruckus.brouhaha.com>
In reply to#9809
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> http://www.complang.tuwien.ac.at/forth/garbage-collection.zip

I remember looking at that and thinking it was really cool, but that its
limitation of not being able to scan the return and locals stacks made
it difficult to use.  Maybe I'm wrong about that.

I remember seeing a mini-Scheme interpreter written in Forth, that
turned out to have no GC, so after it ran for a while it would just run
out of memory.  I half-remember looking at it and deciding that the way
it was written, fixing that problem by plugging your GC into it would
have been difficult.

[toc] | [prev] | [next] | [standalone]


#9816

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-03 14:14 -0600
Message-ID<UtCdnciBiI415s_SnZ2dnUVZ_oWdnZ2d@supernews.com>
In reply to#9810
Paul Rubin <no.email@nospam.invalid> wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> http://www.complang.tuwien.ac.at/forth/garbage-collection.zip
> 
> I remember looking at that and thinking it was really cool, but that its
> limitation of not being able to scan the return and locals stacks made
> it difficult to use.  Maybe I'm wrong about that.

It's not difficult to scan the return stack in any Forth that I'm
aware of.  It's hard to do it in standard Forth, but that's not likely
to matter to anyone who needs it in some application.

> I remember seeing a mini-Scheme interpreter written in Forth, that
> turned out to have no GC, so after it ran for a while it would just run
> out of memory.  I half-remember looking at it and deciding that the way
> it was written, fixing that problem by plugging your GC into it would
> have been difficult.

Really?  I'm surprised.  A conservative GC should Just Work, as long
as it can find all the roots and you don't care about a few memory
leaks due to false positives.

Andrew.

[toc] | [prev] | [next] | [standalone]


Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.forth


csiph-web