Re: [Factor-talk] Managing many vocabularies

2012-11-30 Thread Leon Konings
Hi John and Alexander,

Thanks for the very useful advice.

I prefer not to use DEFER: (pun intended), but if it turns out to be  
the best solution I will.

Best regards,
Leon Konings


Quoting John Benediktsson mrj...@gmail.com:

 Alex has good advice.

 In addition, if you have a circularity inside a single vocab, the DEFER:
 mechanism allows something like this to be resolved properly:

 DEFER: bar

 : foo ( -- x ) bar ;

 : bar ( -- x ) 12 ;

 Usually circularities between vocabs can be resolved by using a central
 vocabulary or a hierarchy to place the word in a commonly used location.
  If you are having difficulties still, you can use a HOOK: to define a word
 that dispatches based on the value of a namespace variable.  For more
 details, see:

 http://docs.factorcode.org/content/word-HOOK__colon__,syntax.html

 Best,
 John.



 On Tue, Nov 27, 2012 at 8:09 PM, Alexander J. Vondrak 
 ajvond...@csupomona.edu wrote:

 Finding circularities: maybe something like
 https://gist.github.com/4158963?
 Though it's not the smartest thing around (just because there's a vocab
 circularity doesn't mean there will necessarily be an issue with a word
 definition).

 Avoiding circularities is really an engineering thing...

 Fixing circularities is trickier, and it'll generally vary case-by-case.
  Check
 out http://docs.factorcode.org/content/article-deferred.html, perhaps?

 Good luck,
 --Alex Vondrak

 
 From: Leon Konings [fac...@koningssoftware.com]
 Sent: Saturday, November 24, 2012 8:29 AM
 To: factor-talk@lists.sourceforge.net
 Subject: Re: [Factor-talk] Managing many vocabularies

 Hi Alexander,

 Thank you for your very long answer.

 You where guessing right about the circular dependencies. Because
 there are so many vocabularies, problems like that happen rather often.

 I am really looking for better and faster ways to find these, and a
 way of working that make it less likely that they happen.

 Best regards,
 Leon


 Quoting Alexander J. Vondrak ajvond...@csupomona.edu:

  I'm not really sure if there was a question in there...
 
  Loading all the vocabularies, which all load many other vocabularies,
  is not easy to do.
 
  If you're just sitting down at your editor, typing vocab names into the
  `USING:` line, then yeah, it's going to be difficult to know exactly
 which
  vocabs you're supposed to specify.  That's why you use the listener.
 
  Say I'm working on a file, factor/work/blah/blah.factor.  While I'm
 jotting
  down some code, I either don't know what I need in the `USING:` or
 forget to
  put something in there.
 
USING: ; ! ???
 
Blah print
 
  From the listener, I type `USE: blah`, and I get a helpful error
 message.
 
IN: scratchpad USE: blah
Loading resource:work/blah/blah.factor
1: USE: blah
^
resource:work/blah/blah.factor
 
1: Blah print
   ^
No word named ?print? found in current vocabulary search path
 
The following restarts are available:
 
:1  Use the io vocabulary
:2  Defer word in current vocabulary
:3  Load resource:work/blah/blah.factor again
 
Type :help for debugging help.
 
  It gives me several options to recover from this error, including a
  suggestion
  for which vocab to load to find the word `print` (note that this
  doesn't always
  work, if Factor can't find a particular word name in the current
  search path).
  In this case, I can type `:1` to use the `io` vocab.
 
IN: scratchpad :1
resource:work/blah/blah.factor:1: Note:
Added io vocabulary to search path
 
Restarts were invoked adding vocabularies to the search path.
To avoid doing this in the future, add the following forms
at the top of the source file:
 
USING: io ;
 
  Also, take a look at
  http://docs.factorcode.org/content/article-images.html and
  http://docs.factorcode.org/content/word-auto-use__que__%2Cparser.html
 
  I often have to solve problems with interdependencies. It is not
  easy to find
  the cause of these problems.
 
  What sort of problems?  And what sort of interdependencies?  Like vocabs
  depending on vocabs?  I struggle to think of a problem with that,
 because the
  chain of dependencies shouldn't be an issue, unless there's a cycle.
  E.g.,
 
! In a.factor
USING: b ;
IN: a
: a-word ( -- ) b-word ;
 
! In b.factor
USING: io ;
IN: b
: b-word ( -- ) Called b-word print ;
 
! At the listener
IN: scratchpad USE: a
Loading resource:work/a/a.factor
Loading resource:work/b/b.factor
IN: scratchpad a-word
Called b-word
 
  Notice that a.factor doesn't need to have `USING: io`, even though
 b.factor
  does.  So you don't need to think about anything beyond a file's
 immediate
  dependencies.  I guess there would be an issue if you had a cyclic
  dependency,
  which needs to be resolved manually (or, more practically speaking,
 removed):
 
! In a.factor

Re: [Factor-talk] Managing many vocabularies

2012-11-27 Thread Alexander J. Vondrak
Finding circularities: maybe something like https://gist.github.com/4158963?
Though it's not the smartest thing around (just because there's a vocab
circularity doesn't mean there will necessarily be an issue with a word
definition).

Avoiding circularities is really an engineering thing...

Fixing circularities is trickier, and it'll generally vary case-by-case.  Check
out http://docs.factorcode.org/content/article-deferred.html, perhaps?

Good luck,
--Alex Vondrak


From: Leon Konings [fac...@koningssoftware.com]
Sent: Saturday, November 24, 2012 8:29 AM
To: factor-talk@lists.sourceforge.net
Subject: Re: [Factor-talk] Managing many vocabularies

Hi Alexander,

Thank you for your very long answer.

You where guessing right about the circular dependencies. Because
there are so many vocabularies, problems like that happen rather often.

I am really looking for better and faster ways to find these, and a
way of working that make it less likely that they happen.

Best regards,
Leon


Quoting Alexander J. Vondrak ajvond...@csupomona.edu:

 I'm not really sure if there was a question in there...

 Loading all the vocabularies, which all load many other vocabularies,
 is not easy to do.

 If you're just sitting down at your editor, typing vocab names into the
 `USING:` line, then yeah, it's going to be difficult to know exactly which
 vocabs you're supposed to specify.  That's why you use the listener.

 Say I'm working on a file, factor/work/blah/blah.factor.  While I'm jotting
 down some code, I either don't know what I need in the `USING:` or forget to
 put something in there.

   USING: ; ! ???

   Blah print

 From the listener, I type `USE: blah`, and I get a helpful error message.

   IN: scratchpad USE: blah
   Loading resource:work/blah/blah.factor
   1: USE: blah
   ^
   resource:work/blah/blah.factor

   1: Blah print
  ^
   No word named “print” found in current vocabulary search path

   The following restarts are available:

   :1  Use the io vocabulary
   :2  Defer word in current vocabulary
   :3  Load resource:work/blah/blah.factor again

   Type :help for debugging help.

 It gives me several options to recover from this error, including a
 suggestion
 for which vocab to load to find the word `print` (note that this
 doesn't always
 work, if Factor can't find a particular word name in the current
 search path).
 In this case, I can type `:1` to use the `io` vocab.

   IN: scratchpad :1
   resource:work/blah/blah.factor:1: Note:
   Added io vocabulary to search path

   Restarts were invoked adding vocabularies to the search path.
   To avoid doing this in the future, add the following forms
   at the top of the source file:

   USING: io ;

 Also, take a look at
 http://docs.factorcode.org/content/article-images.html and
 http://docs.factorcode.org/content/word-auto-use__que__%2Cparser.html

 I often have to solve problems with interdependencies. It is not
 easy to find
 the cause of these problems.

 What sort of problems?  And what sort of interdependencies?  Like vocabs
 depending on vocabs?  I struggle to think of a problem with that, because the
 chain of dependencies shouldn't be an issue, unless there's a cycle.  E.g.,

   ! In a.factor
   USING: b ;
   IN: a
   : a-word ( -- ) b-word ;

   ! In b.factor
   USING: io ;
   IN: b
   : b-word ( -- ) Called b-word print ;

   ! At the listener
   IN: scratchpad USE: a
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   IN: scratchpad a-word
   Called b-word

 Notice that a.factor doesn't need to have `USING: io`, even though b.factor
 does.  So you don't need to think about anything beyond a file's immediate
 dependencies.  I guess there would be an issue if you had a cyclic
 dependency,
 which needs to be resolved manually (or, more practically speaking, removed):

   ! In a.factor
   USING: b io ;
   IN: a

   : a-word1 ( -- ) b-word ;

   : a-word2 ( -- ) Called a-word2 print ;

   ! In b.factor
   USING: a ;

   : b-word ( -- ) a-word2 ;

   ! At the listener
   IN: scratchpad USE: a
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   1: USE: a
^
   resource:work/a/a.factor

   1: USING: b io ;
  ^
   resource:work/b/b.factor

   4: : b-word ( -- ) a-word2 ;
 ^
   No word named “a-word2” found in current vocabulary search path

   The following restarts are available:

   :1  Defer word in current vocabulary
   :2  Load resource:work/b/b.factor again
   :3  Load resource:work/a/a.factor again

   Type :help for debugging help.
   IN: scratchpad :3
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   Loading resource:work/a/a.factor
   IN: scratchpad a-word1
   Called a-word2

 Maybe by interdependencies you mean that vocabs can step on each others'
 toes?  If two vocabs define different words with the same name

Re: [Factor-talk] Managing many vocabularies

2012-11-24 Thread Leon Konings
Hi Alexander,

Thank you for your very long answer.

You where guessing right about the circular dependencies. Because  
there are so many vocabularies, problems like that happen rather often.

I am really looking for better and faster ways to find these, and a  
way of working that make it less likely that they happen.

Best regards,
Leon


Quoting Alexander J. Vondrak ajvond...@csupomona.edu:

 I'm not really sure if there was a question in there...

 Loading all the vocabularies, which all load many other vocabularies,
 is not easy to do.

 If you're just sitting down at your editor, typing vocab names into the
 `USING:` line, then yeah, it's going to be difficult to know exactly which
 vocabs you're supposed to specify.  That's why you use the listener.

 Say I'm working on a file, factor/work/blah/blah.factor.  While I'm jotting
 down some code, I either don't know what I need in the `USING:` or forget to
 put something in there.

   USING: ; ! ???

   Blah print

 From the listener, I type `USE: blah`, and I get a helpful error message.

   IN: scratchpad USE: blah
   Loading resource:work/blah/blah.factor
   1: USE: blah
   ^
   resource:work/blah/blah.factor

   1: Blah print
  ^
   No word named “print” found in current vocabulary search path

   The following restarts are available:

   :1  Use the io vocabulary
   :2  Defer word in current vocabulary
   :3  Load resource:work/blah/blah.factor again

   Type :help for debugging help.

 It gives me several options to recover from this error, including a  
 suggestion
 for which vocab to load to find the word `print` (note that this  
 doesn't always
 work, if Factor can't find a particular word name in the current  
 search path).
 In this case, I can type `:1` to use the `io` vocab.

   IN: scratchpad :1
   resource:work/blah/blah.factor:1: Note:
   Added io vocabulary to search path

   Restarts were invoked adding vocabularies to the search path.
   To avoid doing this in the future, add the following forms
   at the top of the source file:

   USING: io ;

 Also, take a look at  
 http://docs.factorcode.org/content/article-images.html and
 http://docs.factorcode.org/content/word-auto-use__que__%2Cparser.html

 I often have to solve problems with interdependencies. It is not  
 easy to find
 the cause of these problems.

 What sort of problems?  And what sort of interdependencies?  Like vocabs
 depending on vocabs?  I struggle to think of a problem with that, because the
 chain of dependencies shouldn't be an issue, unless there's a cycle.  E.g.,

   ! In a.factor
   USING: b ;
   IN: a
   : a-word ( -- ) b-word ;

   ! In b.factor
   USING: io ;
   IN: b
   : b-word ( -- ) Called b-word print ;

   ! At the listener
   IN: scratchpad USE: a
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   IN: scratchpad a-word
   Called b-word

 Notice that a.factor doesn't need to have `USING: io`, even though b.factor
 does.  So you don't need to think about anything beyond a file's immediate
 dependencies.  I guess there would be an issue if you had a cyclic  
 dependency,
 which needs to be resolved manually (or, more practically speaking, removed):

   ! In a.factor
   USING: b io ;
   IN: a

   : a-word1 ( -- ) b-word ;

   : a-word2 ( -- ) Called a-word2 print ;

   ! In b.factor
   USING: a ;

   : b-word ( -- ) a-word2 ;

   ! At the listener
   IN: scratchpad USE: a
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   1: USE: a
^
   resource:work/a/a.factor

   1: USING: b io ;
  ^
   resource:work/b/b.factor

   4: : b-word ( -- ) a-word2 ;
 ^
   No word named “a-word2” found in current vocabulary search path

   The following restarts are available:

   :1  Defer word in current vocabulary
   :2  Load resource:work/b/b.factor again
   :3  Load resource:work/a/a.factor again

   Type :help for debugging help.
   IN: scratchpad :3
   Loading resource:work/a/a.factor
   Loading resource:work/b/b.factor
   Loading resource:work/a/a.factor
   IN: scratchpad a-word1
   Called a-word2

 Maybe by interdependencies you mean that vocabs can step on each others'
 toes?  If two vocabs define different words with the same name, there will be
 an ambiguity.  To resolve, see
 http://docs.factorcode.org/content/word-FROM__colon__,syntax.html

 In the developer tools I saw some interesting words for working with
 vocabularies. There might be a solution to my problem, if I use these
 tools, but I do not know where to start.

 Which interesting words?  Sorry, I'm running out of psychic abilities.  :)

 If you aren't sure what certain words do, it's helpful to browse  
 through their
 documentation.  Even if a word isn't quite what you want, there are usually
 related things you can click on, looking for related words until you stumble
 onto something useful.

 Hope any of that helps,
 --Alex Vondrak
 

[Factor-talk] Managing many vocabularies

2012-11-23 Thread Leon Konings
Hi,

I am working on a rather big project.

Loading all the vocabularies, which all load many other vocabularies,  
is not easy to do. I often have to solve problems with  
interdependencies. It is not easy to find the cause of these problems.

In the developer tools I saw some interesting words for working with  
vocabularies. There might be a solution to my problem, if I use these  
tools, but I do not know where to start.

Best regards,

Leon


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Managing many vocabularies

2012-11-23 Thread Alexander J. Vondrak
I'm not really sure if there was a question in there...

 Loading all the vocabularies, which all load many other vocabularies, 
 is not easy to do. 

If you're just sitting down at your editor, typing vocab names into the
`USING:` line, then yeah, it's going to be difficult to know exactly which
vocabs you're supposed to specify.  That's why you use the listener.

Say I'm working on a file, factor/work/blah/blah.factor.  While I'm jotting
down some code, I either don't know what I need in the `USING:` or forget to
put something in there.

  USING: ; ! ???

  Blah print

From the listener, I type `USE: blah`, and I get a helpful error message.

  IN: scratchpad USE: blah
  Loading resource:work/blah/blah.factor
  1: USE: blah
  ^
  resource:work/blah/blah.factor

  1: Blah print
 ^
  No word named “print” found in current vocabulary search path

  The following restarts are available:

  :1  Use the io vocabulary
  :2  Defer word in current vocabulary
  :3  Load resource:work/blah/blah.factor again

  Type :help for debugging help.

It gives me several options to recover from this error, including a suggestion
for which vocab to load to find the word `print` (note that this doesn't always
work, if Factor can't find a particular word name in the current search path).
In this case, I can type `:1` to use the `io` vocab.

  IN: scratchpad :1
  resource:work/blah/blah.factor:1: Note:
  Added io vocabulary to search path

  Restarts were invoked adding vocabularies to the search path.
  To avoid doing this in the future, add the following forms
  at the top of the source file:

  USING: io ;

Also, take a look at http://docs.factorcode.org/content/article-images.html and
http://docs.factorcode.org/content/word-auto-use__que__%2Cparser.html

 I often have to solve problems with interdependencies. It is not easy to find
 the cause of these problems.

What sort of problems?  And what sort of interdependencies?  Like vocabs
depending on vocabs?  I struggle to think of a problem with that, because the
chain of dependencies shouldn't be an issue, unless there's a cycle.  E.g.,

  ! In a.factor
  USING: b ;
  IN: a
  : a-word ( -- ) b-word ;

  ! In b.factor
  USING: io ;
  IN: b
  : b-word ( -- ) Called b-word print ;

  ! At the listener
  IN: scratchpad USE: a
  Loading resource:work/a/a.factor
  Loading resource:work/b/b.factor
  IN: scratchpad a-word
  Called b-word

Notice that a.factor doesn't need to have `USING: io`, even though b.factor
does.  So you don't need to think about anything beyond a file's immediate
dependencies.  I guess there would be an issue if you had a cyclic dependency,
which needs to be resolved manually (or, more practically speaking, removed):

  ! In a.factor
  USING: b io ;
  IN: a

  : a-word1 ( -- ) b-word ;

  : a-word2 ( -- ) Called a-word2 print ;

  ! In b.factor
  USING: a ;

  : b-word ( -- ) a-word2 ;

  ! At the listener
  IN: scratchpad USE: a
  Loading resource:work/a/a.factor
  Loading resource:work/b/b.factor
  1: USE: a
   ^
  resource:work/a/a.factor

  1: USING: b io ;
 ^
  resource:work/b/b.factor

  4: : b-word ( -- ) a-word2 ;
^
  No word named “a-word2” found in current vocabulary search path

  The following restarts are available:

  :1  Defer word in current vocabulary
  :2  Load resource:work/b/b.factor again
  :3  Load resource:work/a/a.factor again

  Type :help for debugging help.
  IN: scratchpad :3
  Loading resource:work/a/a.factor
  Loading resource:work/b/b.factor
  Loading resource:work/a/a.factor
  IN: scratchpad a-word1
  Called a-word2

Maybe by interdependencies you mean that vocabs can step on each others'
toes?  If two vocabs define different words with the same name, there will be
an ambiguity.  To resolve, see
http://docs.factorcode.org/content/word-FROM__colon__,syntax.html

 In the developer tools I saw some interesting words for working with 
 vocabularies. There might be a solution to my problem, if I use these 
 tools, but I do not know where to start.

Which interesting words?  Sorry, I'm running out of psychic abilities.  :)

If you aren't sure what certain words do, it's helpful to browse through their
documentation.  Even if a word isn't quite what you want, there are usually
related things you can click on, looking for related words until you stumble
onto something useful.

Hope any of that helps,
--Alex Vondrak
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net