On Tue, Sep 15, 2009 at 4:05 PM, Hugh Aguilar <[email protected]> wrote:
> The reason why I am struggling with Factor is that I'm not accustomed to
looking things up in the documentation. In Forth I wouldn't even consider
looking up something like enum to find out if it is included in the language
or in the libraries; I would just write it myself.

Unfortunately this approach doesn't work so well for anything more
complicated. And even with something like 'enum', you don't want every
programmer on your project re-inventing the wheel.

> Does Factor provide any facility for writing compile-time code?

Yes. Factor has 'parsing words' which are almost the same as Forth's
'immediate words'. You can read about them here:

http://docs.factorcode.org/content/article-parsing-words.html

We also have Lisp-style macros:

http://docs.factorcode.org/content/article-macros.html

Finally, the simplest form of compile-time evaluation is declaring a
word 'foldable':

http://docs.factorcode.org/content/word-foldable%2Csyntax.html

To answer your specific question, Factor does support C-style 'enums':

http://docs.factorcode.org/content/word-C-ENUM__colon__%2Calien.syntax.html

However, as Doug suggested, unless you need the numeric value for
something you should use symbols instead.

Slava

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to