Here's what I would do:

- Add `(provide (all-defined-out))` at the top of the file (or in a
#lang elixir)
- Have `(define ...)` just be the regular racket define.
- Have `(definep f e)` work like this:

  (define f* e)
  (define-syntax f (make-rename-transformer (syntax-property #'f*
'not-provide-all-defined-out #t)))

That way you can't reference f* anywhere, so it's private, and `f` is
not automatically provided. Of course, you can still explicitly
provide `f` if you want.

Sam



On Mon, Mar 21, 2016 at 10:56 AM, Sean Kanaley <skana...@gmail.com> wrote:
> What if you define define as define/provide and define definep as define?
>
> That doesn't answer the question about black magic though.
>
> On Mon, Mar 21, 2016 at 10:51 AM, Brian Adkins <lojicdot...@gmail.com>
> wrote:
>>
>> I've been porting my friend's Elixir code to Racket with great success.
>> When I asked what the equivalent of (provide my-func) was in Elixir, they
>> mentioned that you can define a private function with defp instead of def.
>> For example:
>>
>> defmodule MyModule do
>>   def foo(a) do
>>     ...
>>   end
>>
>>   defp bar(b) do
>>     ...
>>   end
>> end
>>
>> vs.
>>
>> #lang racket
>> (provide foo)
>>
>> (define (foo a) ... )
>> (define (bar a) ... )
>>
>>
>> I prefer the Racket way, but it made me curious about the possibility of a
>> definep macro that would work similarly as a thought experiment.
>>
>> Is it possible to do the following?
>>
>> #lang racket
>>
>> (define (foo a) ... )
>> (definep (bar a) ... )
>>
>> I'm not asking for someone to help with definep - I'm just curious about
>> the possibility of a macro adding/modifying something outside of its scope.
>> In other words, could a definep macro create or modify the proper (provide)
>> construct to export foo and not bar ?
>>
>> Thanks,
>> Brian
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to