Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving FStar.Pprint into the (normal, application) library #3582

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

mtzguido
Copy link
Member

This exposes the pretty-printing module for all F* applications by placing it into FStar.Pprint.fsti, instead of FStar.Stubs.Pprint.fsti. The FStar.Stubs namespace is for interacting with compiler internals, which made sense since FStarC_Pprint.ml is the implementation of this module, but prevents normal applications from using pretty printing without bringing in the rest of the compiler.

This removes this problem by just making this a normal ulib module. The compile still uses a different version internally, due to needing it in the ML effect, but this does not concern F* application writers.

It also fixes a nasty issue I hadn't noticed where extracting a literal doc was essentially returning Obj.magic (). This is since extraction does not know about FStar.Pprint.doc which is what FStar.Stubs.Pprint (with --codegen OCaml) was translated to, since the FStar.Pprint module doesn't exist. The right thing here, now that FStar and FStarC are distinguished, is drop the Stubs namespace and have an FStarC namespace of interfaces in ulib, avoiding the name wrangling.

The Stubs namespace is for pointing to internal compiler modules, where
Pprint is implemented (FStarC_Pprint.ml). However, it makes sense for
applications to want to use pretty-printing without any relation to the
compiler internals, so this module should just be a normal module in the
library, which is what this patch does.

Ideally, we would also remove the FStarC.Pprint.fsti from src/, and use
this, but there are some problems wrt effect polymorphism. So, we just
duplicate them for now (the interface was already duplicated partly due
to that).
We had essentially a type error, likely since extraction did not know
about FStar.Pprint. This is more reason to ditch FStar.Stubs and just
use FStarC.
mtzguido added a commit to mtzguido/pulse that referenced this pull request Oct 17, 2024
@mtzguido mtzguido merged commit 7509a2a into FStarLang:master Oct 17, 2024
2 checks passed
@mtzguido mtzguido deleted the pprint_in_ulib branch October 17, 2024 23:22
mtzguido added a commit to mtzguido/steel that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant