caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] Introspection of functions with Utop
@ 2020-04-21 11:41 orbifx
  2020-04-21 14:09 ` Ali M.
  0 siblings, 1 reply; 7+ messages in thread
From: orbifx @ 2020-04-21 11:41 UTC (permalink / raw)
  To: caml-list

Is there a way for utop to show the definition of a function? Or does it compile it right after parsing it?

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-21 11:41 [Caml-list] Introspection of functions with Utop orbifx
@ 2020-04-21 14:09 ` Ali M.
  2020-04-24 16:05   ` orbifx
  0 siblings, 1 reply; 7+ messages in thread
From: Ali M. @ 2020-04-21 14:09 UTC (permalink / raw)
  To: orbifx; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

I would suggest to also ask this question on the discourse forum
https://discuss.ocaml.org/
You might get better interaction

On Tue, Apr 21, 2020 at 7:41 AM orbifx <fox@orbitalfox.eu> wrote:

> Is there a way for utop to show the definition of a function? Or does it
> compile it right after parsing it?
>
> Thanks
>

[-- Attachment #2: Type: text/html, Size: 665 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-21 14:09 ` Ali M.
@ 2020-04-24 16:05   ` orbifx
  2020-04-25  6:43     ` Malcolm Matalka
  0 siblings, 1 reply; 7+ messages in thread
From: orbifx @ 2020-04-24 16:05 UTC (permalink / raw)
  To: Ali M.; +Cc: caml-list

On 21/04/2020 15:08, Ali M. wrote:
> I would suggest to also ask this question on the discourse forum
> https://discuss.ocaml.org/
> You might get better interaction

Thank you. I prefer the mailing list directly. I was given an answer on this by Alan in the XMPP room[1] for OCaml.

[1]: xmpp:ocaml@conference.orbitalfox.eu?join

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-24 16:05   ` orbifx
@ 2020-04-25  6:43     ` Malcolm Matalka
  2020-04-25 13:20       ` Alan Schmitt
  0 siblings, 1 reply; 7+ messages in thread
From: Malcolm Matalka @ 2020-04-25  6:43 UTC (permalink / raw)
  To: orbifx; +Cc: Ali M., caml-list


orbifx <fox@orbitalfox.eu> writes:

> On 21/04/2020 15:08, Ali M. wrote:
>> I would suggest to also ask this question on the discourse forum
>> https://discuss.ocaml.org/
>> You might get better interaction
>
> Thank you. I prefer the mailing list directly. I was given an answer
> on this by Alan in the XMPP room[1] for OCaml.

What's the answer??

>
> [1]: xmpp:ocaml@conference.orbitalfox.eu?join


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-25  6:43     ` Malcolm Matalka
@ 2020-04-25 13:20       ` Alan Schmitt
  2020-04-25 13:37         ` Basile Starynkevitch
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Schmitt @ 2020-04-25 13:20 UTC (permalink / raw)
  To: Malcolm Matalka, orbifx; +Cc: Ali M., caml-list

On 2020-04-25 08:43, Malcolm Matalka <mmatalka@gmail.com> writes:

> What's the answer??

There is no way to print the code of the function. It is compiled to
bytecode by the toplevel and added to the current environment.

Best,

Alan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-25 13:20       ` Alan Schmitt
@ 2020-04-25 13:37         ` Basile Starynkevitch
  2020-04-27 16:12           ` Josh Berdine
  0 siblings, 1 reply; 7+ messages in thread
From: Basile Starynkevitch @ 2020-04-25 13:37 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]


On 4/25/20 3:12 PM, Alan Schmitt wrote:
> On 2020-04-25 08:43, Malcolm Matalka <mmatalka@gmail.com> writes:
>
>> What's the answer??
> There is no way to print the code of the function. It is compiled to
> bytecode by the toplevel and added to the current environment.


Unless (on Linux/x86-64 at least) you compile the code with the -g 
debugging option.


Adventurous developers could even couple that with Ian Taylor's 
libbacktrace library. I leave them to check license compatibility with 
their lawyers.

https://github.com/ianlancetaylor/libbacktrace

The real issue is of course funding, as usual. DWARF support in Ocaml 
needs improvement.

https://en.wikipedia.org/wiki/DWARF


> -- 

Basile STARYNKEVITCH   == http://starynkevitch.net/Basile
opinions are mine only - les opinions sont seulement miennes
Bourg La Reine, France; <basile@starynkevitch.net>
(mobile phone: cf my web page / voir ma page web...)


[-- Attachment #2: Type: text/html, Size: 2130 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Introspection of functions with Utop
  2020-04-25 13:37         ` Basile Starynkevitch
@ 2020-04-27 16:12           ` Josh Berdine
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Berdine @ 2020-04-27 16:12 UTC (permalink / raw)
  To: caml-list

> On Apr 25, 2020, at 2:37 PM, Basile Starynkevitch <basile@starynkevitch.net> wrote:
>> On 4/25/20 3:12 PM, Alan Schmitt wrote:
>>> On 2020-04-25 08:43, Malcolm Matalka <mmatalka@gmail.com> writes:
>> 
>>> What's the answer??
>>> 
>> There is no way to print the code of the function. It is compiled to
>> bytecode by the toplevel and added to the current environment.
>> 
> 
> Unless (on Linux/x86-64 at least) you compile the code with the -g debugging option.
> 
> Adventurous developers could even couple that with Ian Taylor's libbacktrace library. I leave them to check license compatibility with their lawyers.
> 
> https://github.com/ianlancetaylor/libbacktrace
> 
> The real issue is of course funding, as usual. DWARF support in Ocaml needs improvement.

Note that in the particular case of DWARF support, my reading of the "Improved DWARF and GDB support" section of https://blog.janestreet.com/a-look-at-ocaml-4.08/ leaves the impression that it is at least as much about upstream receptiveness as about resources.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 11:41 [Caml-list] Introspection of functions with Utop orbifx
2020-04-21 14:09 ` Ali M.
2020-04-24 16:05   ` orbifx
2020-04-25  6:43     ` Malcolm Matalka
2020-04-25 13:20       ` Alan Schmitt
2020-04-25 13:37         ` Basile Starynkevitch
2020-04-27 16:12           ` Josh Berdine

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox