Eduardo Cavazos | 1 Feb 2007 09:18
Picon

Factor/vocabs

Slava,

So what do you think about having Factor/vocabs be a sandbox for testing out 
module system ideas? I would move my code in there (x wm factory) and maybe 
port some older stuff too.

Ed

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Eduardo Cavazos | 1 Feb 2007 10:57
Picon

more on forward references

Slava,

Right now, all we have is IN:. This let's us inject words into new or existing 
vocabularies. That's a cool feature but we abuse it, leading to the problems 
you cited in your email.

VOCABULARY:	A parsing word which specifies the vocabulary of the file. If the
		vocabulary exists, [ forget ] each is done on it's words first.

IN:		Same old familiar IN:, ready to be abused in a controlled fasion.

Ed

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Eduardo Cavazos | 1 Feb 2007 10:41
Picon

forward references

>From "module system considered harmful"

----------------------------------------------------------------------
2) Suppose you have a source file where you write,

IN: foo
: a ;
: b a ;

You load the source file into Factor. Then you add a new word definition
: c b ; but you add it _before_ the definition of b. The file still
loads, however, because the definition of b is present in the vocabulary
when c is parsed.

But if you start Factor with a clean image, the source file won't load
(and bottom-up ordering of definitions a good thing; in CL,
automatically interning symbols in the wrong package can be a source of
problems).

--

The new module system can fix the problem (which is that the modified
source file could load without an error in the first place) as follows.
You start by marking words in a module with a special flag before
reloading the module; then as each definition is read, the word's flag
is reset. If a definition refers to a word with the flag still set, a
parse-time error is raised. When the module is finished loading, the
module system can also check if any words which have the flag set are
still referenced by words in other modules; if so, a message can be
printing instructing the programmer to either reintroduce the word, or
(Continue reading)

Eduardo Cavazos | 1 Feb 2007 11:56
Picon

Re: forward references


> Is there something wrong with simply doing this:
>
> 	"foo" words [ forget ] each
>
> when foo is reloaded?

Hmmm. So I'm trying this out and noticing that this isn't enough.

--------------------foo.factor----------------------------------------
IN: foo

: a 10 ;

: b 20 ;

: c 30 ;
----------------------------------------------------------------------

--------------------bar.factor----------------------------------------
USE: foo

IN: bar

: aa a ;

: bb b ;

: cc c ;
----------------------------------------------------------------------
(Continue reading)

Eduardo Cavazos | 1 Feb 2007 12:20
Picon

forward references: marking words technique

Slava,

Here's your idea about marking words:

: mark-words ( vocab -- ) words [ t "unloaded" set-word-prop ] each ;

: check-def ( quot -- )
[ word? ] subset
[ "unloaded" word-prop ] find nip
dup [ throw ] [ drop ] if ;

: define ( word def primitive -- )
    over check-def
    pick f "unloaded" set-word-prop
    pick changed-word
    pick unxref-word
    pick set-word-primitive
    over set-word-def
    dup update-xt
    xref-word ;

So before reloading a vocabulary foo, this is done:

	"foo" mark-words

Then the rest of the file is parsed as usual. The ':' word calls define which 
takes care of checking the definition for references to "unloaded" 
words. 'define' then resets the "unloaded" flag.

The above words work on some simple cases that I tried. What do you think?
(Continue reading)

Eduardo Cavazos | 1 Feb 2007 12:50
Picon

tcp/ip streams problem

Slava,

start cabal on onigirihouse. run in screen, detach, logout

xterm 1 : telnet to onigirihouse:8000. login as "user1"

xterm 2 : telnet to onigirihouse:8000. login as "user2"

Wait for half an hour or so. Eventually I see this error message in the xterms 
that were connected to cabal: "Connection closed by foreign host." (I think 
this is not a problem with Factor or cabal, but due to flakiness with linnode 
or the network between me and them.)

ssh to onigirihouse. attach to screen. Inspect the users variable:

	users> [ duplex-stream-closed? ] map .
	V{ f f }

This is unexpected. The connections were closed so I'm expecting these to 
return true. Another thing, if I use the scrollback capability in the screen, 
I notice these two lines:

	Error on fd 10: Connection reset by peer
	Error on fd 9: Connection reset by peer

Should Factor be closing these streams when those reset errors occur? That 
they aren't closed is causing the problem with cabal; when new users connect, 
they are indeed connected but cabal has trouble writing to these users which 
appear to not have closed streams.

(Continue reading)

Slava Pestov | 1 Feb 2007 19:33

Re: tcp/ip streams problem


On 1-Feb-07, at 6:50 AM, Eduardo Cavazos wrote:

>
> 	users> [ duplex-stream-closed? ] map .
> 	V{ f f }

The duplex-stream-closed? flag is set only if you explicitly call  
stream-close on the stream.

Slava

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Daniel Ehrenberg | 1 Feb 2007 19:43
Picon

UTF-16

Slava,
In the Factor docs and word names, there are a bunch of references to
UTF-16 (eg http://factorcode.org/responder/help/show-help?topic=c%2dstrings).
However, what you're talking about is fixed-width with no surrogate
pairs, so it's inaccurate to call it UTF-16. Really, it's UCS-2. Could
you fix this?
Dan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Slava Pestov | 1 Feb 2007 19:46

Re: UTF-16

Thanks for pointing this out. I know very little about Unicode.

Slava

On 1-Feb-07, at 1:43 PM, Daniel Ehrenberg wrote:

> Slava,
> In the Factor docs and word names, there are a bunch of references to
> UTF-16 (eg http://factorcode.org/responder/help/show-help?topic=c% 
> 2dstrings).
> However, what you're talking about is fixed-width with no surrogate
> pairs, so it's inaccurate to call it UTF-16. Really, it's UCS-2. Could
> you fix this?
> Dan
>
> ---------------------------------------------------------------------- 
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@...
> https://lists.sourceforge.net/lists/listinfo/factor-talk

(Continue reading)

Eduardo Cavazos | 1 Feb 2007 23:03
Picon

tcp/ip streams problem

Slava,

Here's a simple test case on a localhost.

factor:

	8000 <server> dup accept

xterm:

	telnet locahost 8000
	<manually close connection>

factor:

	"hey" over stream-print dup stream-flush
	! this doesn't produce an error. shouldn't it?

	"hey" over stream-print dup stream-flush
	! this time I do get an error:
	! Error on fd 4: Broken pipe
	! Debugger commands: ...

	"hey" over stream-print dup stream-flush
	! factor is now blocked.

Why isn't there an error message on the first send? Why does Factor block on 
the third send? When Factor notices a "Broken pipe" error on a stream, should 
Factor mark the stream as closed? Maybe this only makes sense for certain 
kinds of errors. Perhaps it should be up to the programmer to catch errors 
(Continue reading)


Gmane