Comments (2)
Using Toploop.execute_phrase
to initialise the toplevel from the
function assigned to Toploop.toplevel_startup_hook
does not work, it
seems that the environment is reset when exiting the hook. Here is an
example illustrating this behaviour:
let execute_toplevel_phrase s =
let phrase =
!Toploop.parse_toplevel_phrase (Lexing.from_string s)
in
if Toploop.execute_phrase true Format.std_formatter phrase then
()
else
failwith "execute_toplevel_phrase"
let bootstrap () =
execute_toplevel_phrase "let zero = 0;;"
let _ =
Toploop.toplevel_startup_hook := bootstrap
While the initialisation routine echoes a val zero : int = 0
message, using zero
results in an error indicating that zero
is
unbound. But in the toplevel, using the command bootstrap()
results
in zero
being bound to 0
as expected.
We therefore may choose to rely exclusively on initialisation files to configure the toplevel adequately. We need to initialise correctly the toplevel, wether it is used in without being installed or being installed.
from bsdowl.
The best way to provide this functionality is to prepare a corresponding initialisation file and ensuring it is read at starting time. To ease this, a target display-developer-dirs
has been added to the ocaml.toplevel.mk
file in 9c85461.
from bsdowl.
Related Issues (20)
- Describe how to port BSD Owl based packages for FreeBSD
- Describe how to port BSD Owl based packages for MacPorts
- Convert existing tests to examples HOT 1
- Support opam pinning HOT 1
- Broken link in doc/Index.md HOT 1
- Add Debian repository keys for Travis CI
- Do not depend unconditionally on ocamlfind HOT 1
- Can't produce OCaml documentation with MAKEOBJDIRPREFIX HOT 4
- Support ocaml -open option HOT 1
- Any plans to support static website generation with boostrap?
- OCaml dependencies are not regenerated HOT 1
- We need an environement variable which can be consulted to tell we are in a subshell
- Dependencies are not properly generated for OCaml because DIRS is ignored HOT 1
- More flexible testsuite HOT 1
- Filter out DS Store files when making distfiles
- Better support for OCaml dependencies in code using extension points HOT 1
- Associate a TeX engine to each format
- Use in Micro Music Player
- Add support for opam-cross-ios HOT 2
- Installation fails where there is a space in the group name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bsdowl.