# How to do an open import in Rhombus

**URL:** <https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785>\
**Category:** Languages\
**Tags:** rhombus\
**Created:** [June 10, 2025, 11:39pm UTC](https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785 "2025-06-10T23:39:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avrame](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/avrame/32/2340_2.png) [@avrame](https://racket.discourse.group/u/avrame)\
**Post date:** [June 10, 2025, 11:39pm UTC](https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785/1 "2025-06-10T23:39:43Z")

</div>

I'm trying to get familiar with Rhombus by programming fizz-buzz. I'm having trouble importing libraries from Racket. The following works, but I'd like to not have to type `base.` in front of each function call. I tried the `open` modifier after the import but that didn't work.

```scheme
#lang rhombus

import:
  lib("racket/base.rkt")

for (i in 1..=100):
  match base.gcd(i, 15)
  | 15: base.displayln("fizzbuzz")
  | 3: base.displayln("fizz")
  | 5: base.displayln("buzz")
  | _: base.displayln(i)

```

---

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [June 11, 2025, 1:21am UTC](https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785/2 "2025-06-11T01:21:08Z")

</div>

Using this seems to work:

```scheme
import:
  lib("racket/base.rkt") expose:
    gcd
    displayln

```

I think `open`ing the entire `lib("racket/base.rkt")` module may have shadowed `for` but I am not sure.

---

<div class="post-metadata">

**Author:** ![avrame](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/avrame/32/2340_2.png) [@avrame](https://racket.discourse.group/u/avrame)\
**Post date:** [June 11, 2025, 1:58am UTC](https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785/3 "2025-06-11T01:58:18Z")

</div>

Thanks shhyou, TIL about `expose`!

---

<div class="post-metadata">

**Author:** ![usao](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/usao/32/1375_2.png) [@usao](https://racket.discourse.group/u/usao)\
**Post date:** [June 11, 2025, 6:10am UTC](https://racket.discourse.group/t/how-to-do-an-open-import-in-rhombus/3785/4 "2025-06-11T06:10:18Z")

</div>

For this program specifically, you shouldn’t need imports at all.

```scheme
#lang rhombus/static

for (i in 1..=100):
  match math.gcd(i, 15)
  | 15: println("fizzbuzz")
  | 3: println("fizz")
  | 5: println("buzz")
  | _: println(i)

```

In general, imports in Rhombus should be prefixed or selectively `expose`d. Only _some_ libraries are intentionally designed to be `open`ed, like `rhombus/rx` or `rhombus/thread`, and they are documented as so, without an import prefix. (The documentation convention [can be found here](https://docs.racket-lang.org/rhombus-reference/doc_notation.html#%28part._.Namespaces_and_.Modules%29).)
