From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 14 00:58:59 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7507E16F; Thu, 14 Nov 2013 00:58:59 +0000 (UTC) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 40B042F5E; Thu, 14 Nov 2013 00:58:59 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.16]) by ltcfislmsgpa06.fnfis.com (8.14.5/8.14.5) with ESMTP id rAE0wqLZ011027 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 13 Nov 2013 18:58:52 -0600 Received: from LTCFISWMSGMB21.FNFIS.com ([169.254.1.152]) by LTCFISWMSGHT05.FNFIS.com ([10.132.206.16]) with mapi id 14.03.0158.001; Wed, 13 Nov 2013 18:58:51 -0600 From: "Teske, Devin" To: Alfred Perlstein Subject: Re: Loader forth changes for customization Thread-Topic: Loader forth changes for customization Thread-Index: AQHO4EjnMi0GIoZQO0eCkJ5RnRP0Cw== Date: Thu, 14 Nov 2013 00:58:51 +0000 Message-ID: <86F0F59A-2DE0-42A3-9B8B-ADB1F3CA55A1@fisglobal.com> References: <5282E56F.4020307@freebsd.org> <52832003.8080406@freebsd.org> <09673101-DB54-4D25-9989-8C80D06E266B@fisglobal.com> <5283933E.30603@freebsd.org> <5283CBD1.9010606@freebsd.org> In-Reply-To: <5283CBD1.9010606@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.132.253.120] Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.14, 0.0.0000 definitions=2013-11-13_06:2013-11-13,2013-11-13,1970-01-01 signatures=0 Cc: FreeBSD Hackers , Devin Teske , "Teske, Devin" , Jordan Hubbard X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list Reply-To: Devin Teske List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Nov 2013 00:58:59 -0000 On Nov 13, 2013, at 10:58 AM, Alfred Perlstein wrote: >=20 > On 11/13/13, 10:01 AM, Jordan Hubbard wrote: >> On Nov 13, 2013, at 6:57 AM, Alfred Perlstein wrote: >>=20 >>> It seems to work although I will talk to the team about making separate= files for the set commands. >> Since we=92re talking about this, there is an old maxim amongst FORTH pr= ogrammers that if a single word=92s definition takes more than a page, it= =92s just too dang long. There are some solid reasons for that, namely th= e fact that forth is already hard enough to read as it is (and I=92m speaki= ng as a FAN of the language) and you generally need to keep the =93internal= stack state=94 in your head while writing a word since the stack contract = is only at word boundaries (e.g. word is defined as tacking stack parameter= s foo and returning stack parameters bar). Keeping the definitions short = and sweet really helps to aid in comprehension. >>=20 >> The definition for draw-beastie currently violates that maxim, and if yo= u guys were to refactor it as part of this work, I=92m sure future generati= ons would not object! :) > I'll give that a shot shortly. >=20 I've already tossed a few things at Alfred today that can help make things a lot simpler. Specifically, for draw-beastie... I came up with an idea that would whack off that big huge if-then block for the various logos. It would be much more efficient to just assume that the function (word) that draws the logo is actually named the same as the desired setting but with a "-logo" suffix. But I went out of the box today on something new... Yes, Forth is a stack based language. But... It can also take its arguments from something known as the "Text Input Buffer" (or TIB for short). In essence, I whipped up this little diddy for Alfred's work... : try-include ['] include catch if 0 parse 2drop then ; immediate This new word is a lot like the "include" word (and a number of other words) in that it takes no stack arguments. Instead, it takes arguments from the input stream. Example... try-include /boot/loader.rc.local try-include /boot/menu.rc.local I designed the "try-include" function to work this way so that it would be more intuitive and would be more "at-home" inside an *.rc file where all the words (like "set" and "include" etc.) are "clean" (more easily understood by non-Forth programmers). Also, regarding the ol' maxim... Don't you find that use of "( before -- after )" inline comments are helpful in reducing the load on mentally having to tabulate the stack contents for larger words? I've tried to use that style in my coding whenever words appear to be getting unwieldy, and would like to know if perhaps it's not that great in dealing with the maxim of keeping things short. --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you.