phillip
2021-7-5 10:37:07

Is there a way to use absolute positioning for gui controls? It seems like place-children may be useful but just curious if anyone has any pointers


soegaard2
2021-7-5 10:44:24

I think place-children sounds right.

If that’s not enough, there is a section on how to define new types of containers.

https://docs.racket-lang.org/gui/windowing-overview.html?q=place-children#%28part._new-containers%29


sorawee
2021-7-5 21:24:35

I have a library with a cleanup procedure.

I have several programs that use this library. I want to run them all. After an execution of each program, I need to clean it up.

There are many ways to set this up:

Method 1) dynamic-require

(dynamic-require /path/to/prog1 #f) (clean-up!) (dynamic-require /path/to/prog2 #f) (clean-up!) The disadvantage of this approach is that I can’t raco make to eliminate the compile-time cost of these programs.

Method 2) require

(require /path/to/prog1) (clean-up!) (require /path/to/prog2) (clean-up!) I can raco make this one fine. The problem is that it doesn’t evaluate expressions in the order I want to due to module instantiation.

Any suggestion?


alexharsanyi
2021-7-5 22:24:45

I would change the program so that they don’t do any work at module initialization. That is:

(require prog1 prog2) (prog1-do-work) (clean-up!) (prog2-do-work) (clean-up!)


sorawee
2021-7-5 23:21:19

Unfortunately, I can’t control how these programs work. They are written by other people


samth
2021-7-6 00:21:28

How about submodules with direct requires and then dynamic-require the submodules


sorawee
2021-7-6 00:22:21

I will try that, thanks!


shu--hung
2021-7-6 02:38:24

I remember there’s API like register-external-module but not sure if that helps. I’ve never dug into the CM api


shu--hung
2021-7-6 02:48:32

Hmm, actually, define-runtime-module-path introduces a dependency. I guess it is already using the above API. [Jul 05 21:47:23]$ cat cli.rkt #lang racket/base (require racket/runtime-path) (define-runtime-module-path srv.rkt "srv.rkt") and [Jul 05 21:47:20]$ raco make -v cli.rkt "cli.rkt": making #<path:....../cli.rkt> making #<path:....../srv.rkt> [output to "compiled/cli_rkt.zo"]