Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread Alexander Ilin
Hello, John! 25.05.2016, 17:54, "John Benediktsson" :One way to work around dependencies like that is to use nested compilation units: << CONSTANT: half-bit-size 6 >><< CONSTANT: bit-size $[ 2 half-bit-size * ] >>CONSTANT: cell-height $[ 3 bit-size * ]CONSTANT: cell-width $[ 3 bit-size * ] That is very, very cool! I'll give that a try, thank you! ---=---Александр 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread John Benediktsson
One way to work around dependencies like that is to use nested compilation
units:

<< CONSTANT: half-bit-size 6 >>
<< CONSTANT: bit-size $[ 2 half-bit-size * ] >>
CONSTANT: cell-height $[ 3 bit-size * ]
CONSTANT: cell-width $[ 3 bit-size * ]

That makes those constants immediately available for the other constants to
use in their literal expansions.  Doug and I have been talking about ways
to avoid this problem with his new parser, but that's for sometime after
0.98 is released.



On Wed, May 25, 2016 at 5:01 AM, Alexander Ilin  wrote:

> Hello!
>
> Initially I wanted to define all constants as dependent on each other, as
> I would do in Delphi or C++:
>
> const
> half-bit-size = 6;
> bit-size = 2 * half-bit-size;
> cell-height = 3 * bit-size;
> cell-width = 3 * bit-size;
>
> In Factor that didn't work, so I took out the half-bit-size constant into
> a separate vocab, and expressed the rest in terms of it. That was an
> inconvenience and a reduction in readability, but not an issue.
>
> The issue I'm having now is this: if I change the half-bit-size value and
> reload its vocab, the dependent constants don't get the new values until I
> reload their module as well (I have a chain of four vocabs total that
> indirectly depend on that value).
>
> I think that if those were executable words, not CONSTANT:s, then changing
> the root value would update the output of those using it, so I would not
> have to reload all modules but the first one. That would have an additional
> benefit of making it possible to update the value at run-time and not
> reload anything (make it a global variable or something).
>
> Basically, I'm exploring my options here between the benefits of the
> compile-time precalculation, and run-time re-calculations. Also, I'm
> thinking a little about the "upgrade paths" available in Factor. What does
> it take to transform a constant into a variable in a Factor program? We
> don't have as many static checks as other languages offer, so I'm trying to
> imagine the possible pitfalls and performance penalties associated with
> different approaches.
>
> Memoization is another thing I'm going to take a look at. Not for this
> particular case, but as part of learning things. Factor is my first
> functional language, mind you, so I'm not too familiar with how things are.
>
> If you have any thoughts about this, please share.
>
> 25.05.2016, 01:01, "John Benediktsson" :
>
> I don't think you should use foldable and flushable from the sounds of
> things.
>
> Foldable is used mostly to inline a computed value as a literal, and
> flushable is used to indicate a word without side effects can be optimized
> by the compiler to not be called if the output is not used.
>
> Are you running into a problem with those constants you are trying to
> solve?
>
> On Tue, May 24, 2016 at 3:54 AM, Alexander Ilin  wrote:
>
> Hello!
>
>   I have some CONSTANT: words, which are used in more CONSTANT:s
> calculated at compile-time:
>
> IN: iqlink.const
>
> ! Bits are rectangular, their size in pixels is here.
> ! All other constants are based on this one.
> CONSTANT: half-bit-size 6
>
> USING: iqlink.const ;
> IN: iqlink.cell.gadget
>
> CONSTANT: bit-size $[ half-bit-size 2 * ]
> CONSTANT: cell-half-height $[ half-bit-size 3 * ]
> CONSTANT: cell-half-width $[ half-bit-size 3 * ]
> CONSTANT: cell-height $[ half-bit-size 6 * ]
> CONSTANT: cell-width $[ half-bit-size 6 * ]
>
>   I've been reading the docs about the foldable and flushable words, and I
> don't quite understand the use cases for them. Should I use these words to
> mark my constants, or should I keep things as they are?
>
>   What if I were to change my UI to be dynamically scalable and change the
> half-bit-size value at run-time? Should I use the foldable and flushable
> then?
>
> ---=---
>  Александр
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
> ,
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ,
>
> 

Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-25 Thread Alexander Ilin
Hello! Initially I wanted to define all constants as dependent on each other, as I would do in Delphi or C++: consthalf-bit-size = 6;bit-size = 2 * half-bit-size;cell-height = 3 * bit-size;cell-width = 3 * bit-size; In Factor that didn't work, so I took out the half-bit-size constant into a separate vocab, and expressed the rest in terms of it. That was an inconvenience and a reduction in readability, but not an issue. The issue I'm having now is this: if I change the half-bit-size value and reload its vocab, the dependent constants don't get the new values until I reload their module as well (I have a chain of four vocabs total that indirectly depend on that value). I think that if those were executable words, not CONSTANT:s, then changing the root value would update the output of those using it, so I would not have to reload all modules but the first one. That would have an additional benefit of making it possible to update the value at run-time and not reload anything (make it a global variable or something). Basically, I'm exploring my options here between the benefits of the compile-time precalculation, and run-time re-calculations. Also, I'm thinking a little about the "upgrade paths" available in Factor. What does it take to transform a constant into a variable in a Factor program? We don't have as many static checks as other languages offer, so I'm trying to imagine the possible pitfalls and performance penalties associated with different approaches. Memoization is another thing I'm going to take a look at. Not for this particular case, but as part of learning things. Factor is my first functional language, mind you, so I'm not too familiar with how things are. If you have any thoughts about this, please share. 25.05.2016, 01:01, "John Benediktsson" :I don't think you should use foldable and flushable from the sounds of things. Foldable is used mostly to inline a computed value as a literal, and flushable is used to indicate a word without side effects can be optimized by the compiler to not be called if the output is not used. Are you running into a problem with those constants you are trying to solve? On Tue, May 24, 2016 at 3:54 AM, Alexander Ilin  wrote:Hello!  I have some CONSTANT: words, which are used in more CONSTANT:s calculated at compile-time:IN: iqlink.const! Bits are rectangular, their size in pixels is here.! All other constants are based on this one.CONSTANT: half-bit-size 6USING: iqlink.const ;IN: iqlink.cell.gadgetCONSTANT: bit-size $[ half-bit-size 2 * ]CONSTANT: cell-half-height $[ half-bit-size 3 * ]CONSTANT: cell-half-width $[ half-bit-size 3 * ]CONSTANT: cell-height $[ half-bit-size 6 * ]CONSTANT: cell-width $[ half-bit-size 6 * ]  I've been reading the docs about the foldable and flushable words, and I don't quite understand the use cases for them. Should I use these words to mark my constants, or should I keep things as they are?  What if I were to change my UI to be dynamically scalable and change the half-bit-size value at run-time? Should I use the foldable and flushable then?---=--- Александр--Mobile security can be enabling, not merely restricting. Employees whobring their own devices (BYOD) to work are irked by the imposition of MDMrestrictions. Mobile Device Manager Plus allows you to control only theapps on BYO-devices by containerizing them, leaving personal data untouched!https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk,--Mobile security can be enabling, not merely restricting. Employees whobring their own devices (BYOD) to work are irked by the imposition of MDMrestrictions. Mobile Device Manager Plus allows you to control only theapps on BYO-devices by containerizing them, leaving personal data untouched!https://ad.doubleclick.net/ddm/clk/304595813;131938128;j,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk  ---=---Александр --
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-24 Thread John Benediktsson
I don't think you should use foldable and flushable from the sounds of
things.

Foldable is used mostly to inline a computed value as a literal, and
flushable is used to indicate a word without side effects can be optimized
by the compiler to not be called if the output is not used.

Are you running into a problem with those constants you are trying to solve?

On Tue, May 24, 2016 at 3:54 AM, Alexander Ilin  wrote:

> Hello!
>
>   I have some CONSTANT: words, which are used in more CONSTANT:s
> calculated at compile-time:
>
> IN: iqlink.const
>
> ! Bits are rectangular, their size in pixels is here.
> ! All other constants are based on this one.
> CONSTANT: half-bit-size 6
>
> USING: iqlink.const ;
> IN: iqlink.cell.gadget
>
> CONSTANT: bit-size $[ half-bit-size 2 * ]
> CONSTANT: cell-half-height $[ half-bit-size 3 * ]
> CONSTANT: cell-half-width $[ half-bit-size 3 * ]
> CONSTANT: cell-height $[ half-bit-size 6 * ]
> CONSTANT: cell-width $[ half-bit-size 6 * ]
>
>   I've been reading the docs about the foldable and flushable words, and I
> don't quite understand the use cases for them. Should I use these words to
> mark my constants, or should I keep things as they are?
>
>   What if I were to change my UI to be dynamically scalable and change the
> half-bit-size value at run-time? Should I use the foldable and flushable
> then?
>
> ---=---
>  Александр
>
>
> --
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] CONSTANT:s - foldable, flushable?

2016-05-24 Thread Alexander Ilin
Hello!

  I have some CONSTANT: words, which are used in more CONSTANT:s calculated at 
compile-time:

IN: iqlink.const

! Bits are rectangular, their size in pixels is here.
! All other constants are based on this one.
CONSTANT: half-bit-size 6

USING: iqlink.const ;
IN: iqlink.cell.gadget

CONSTANT: bit-size $[ half-bit-size 2 * ]
CONSTANT: cell-half-height $[ half-bit-size 3 * ]
CONSTANT: cell-half-width $[ half-bit-size 3 * ]
CONSTANT: cell-height $[ half-bit-size 6 * ]
CONSTANT: cell-width $[ half-bit-size 6 * ]

  I've been reading the docs about the foldable and flushable words, and I 
don't quite understand the use cases for them. Should I use these words to mark 
my constants, or should I keep things as they are?

  What if I were to change my UI to be dynamically scalable and change the 
half-bit-size value at run-time? Should I use the foldable and flushable then?

---=---
 Александр

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk