Hi, Benediktsson.

Of cause it is helpful!

In fact, I have read this post:
http://re-factor.blogspot.com/2011/08/printf.html two or three days
ago.
At that time, I wanted to format each character in the string resulted
from nfc in the unicode.normalize vocab in more obvious way. And
google guided me to this post.
I didn't read it carefully and just followed this link in it:
http://docs.factorcode.org/content/word-sprintf,formatting.html ...

After that, I have reread it. I got some ideas about:
* sprintf reuse the implementation of printf with the help of
with-string-writer.
* the format string is not parsed at runtime and could increase
runtime performance.
But I couldn't get the detail about the macro, peg, and different
*times* in Factor currently.

The most interesting thing to me is that the format string also accept
something other than string literal:

  IN: scratchpad 12 { CHAR: % CHAR: d } >string sprintf .
  "12"

What will happen when the format string is a runtime value? printf
will translate the format string to some codes which actually format
the arguments when the it is a literal and fallback to runtime
analytic when it is unknown(e.g. command line argument) before run,
right?
I have also taken a glance at
https://github.com/slavapestov/factor/blob/0.96/basis/formatting/formatting.factor
.
There is(of cause) no duplicated code for both literal and runtime
value. But I also couldn't find the key point which make the fallback
happen automatically.
It sounds like a magic if we could write a program(e.g.
$./factor-printf %d 12), compile and run it!

Furthermore, I found there are many *factor*.blogspot.com in the internet!

Notably: 
http://factor-language.blogspot.com/2010/04/switching-call-stacks-on-different.html
I wanted to introduce coroutine into C around that time. What I knew
were a little x86 asm, setjmp/longjmp, fibers and contextS.
setjmp/longjmp is not reliable obviously. I wasn't familiar with OS
other than Windows at that time, especially the signal part which
almost get ignored by Windows. The only thing I could depend on is
fibers.
I searched in the internet and got this post. Thanks to it, I realized
it is too difficult to me to make it portable, especially in netbsd.
So I gave up...

I can't recall whether I knew this blog is an author of a programming
language or not at that time. But I heard about Factor for at least
one year because there is a Factor 0.95 on another computer running
Windows downloaded at one year before.
I'm working on a startup using Clojure(which is new to me) and
learning Haskell in spare time. I couldn't start to learn a third
language for no reason...

And this 
post(http://useless-factor.blogspot.com/2007/07/unicode-implementers-guide-part-2.html)
leads me to Factor eventually for two reasons:
As you see, I got a problem related to Unicode. The author knew many
aspects of Unicode and even got check from Donald
Knuth(http://useless-factor.blogspot.com/2007/05/im-rich.html)!
I previously thought there may be some bug cause by one assumption in
many Java programmers: each element in String is a character. And this
assumption is a fact in Factor.
If I gave up again, when could I get another chance? So I started to
learn it ...

BTW: it is me to make another wrong assumption about NFC...

Finally, Factor and the people around it are so cool!

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to