Methods on object work for any object, even ``f``, but any more specific
type will override and get called instead. Methods on object are default
methods, but the windows-specific method is worse since it blocks.

Is there a native windows api call that doesn't block, or should we just
use the default copy-file?


On Tue, Jun 14, 2016 at 2:11 PM, Alexander Ilin <ajs...@yandex.ru> wrote:

> Hello, Doug!
>
> I'm a bit confused, because I found this code:
>
> IN: io.directories.windows
>
> M: windows copy-file ( from to -- )
>     dup parent-directory make-directories
>     [ normalize-path ] bi@ 0 CopyFile win32-error=0/f ;
>
> This code defines copy-file as a method on "windows", and the code you
> quoted below defines copy-file as a method on "object".
>
> In what circumstances io-backend will have an instance of an "object"
> (instead of windows, unix, etc.) so that the code you quoted is actually
> executed?
>
> Is it the default implementation in case "windows" has no "copy-file"
> method?
>
> 14.06.2016, 22:37, "Doug Coleman" <doug.cole...@gmail.com>:
>
> Hey Alexander,
>
> We have a copy-file implemented with stream-copy already. It's
> non-blocking and it might be fast enough, or we could optimize it. I
> haven't looked at CopyFile for a long time, but maybe we shouldn't use that
> and should use the default stream-copy version instead. Then you don't have
> to replace the io-backend with a different one.
>
> Doug
>
>
> ! From basis/io/directories/directories.factor
> IN: io.directories
>
> ! Copying files
> HOOK: copy-file io-backend ( from to -- ) ;
>
> M: object copy-file
>     dup parent-directory make-directories
>     binary <file-writer> [
>         swap binary <file-reader> [
>             swap stream-copy
>         ] with-disposal
>     ] with-disposal ;
>
>
> ---=====---
> Александр
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning
> reports.
> http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to