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

Problems in the repl #105

Open
bentxt opened this issue Mar 25, 2021 · 1 comment
Open

Problems in the repl #105

bentxt opened this issue Mar 25, 2021 · 1 comment

Comments

@bentxt
Copy link

bentxt commented Mar 25, 2021

Hi,
Sorry for the lack of a better title, and even worse the title is eventually wrong.

But the thing I want to accomplish is to interactively play with some functions in the repl. In stead of real data, all results look pretty abstract, maybe because Luv.Loop didn't kicked of all the events?

Here's my naive attempt.

let res = Luv.DNS.getaddrinfo ~family:`INET ~node:"google.com" ();;
Luv.Loop.run ();;
@aantron
Copy link
Owner

aantron commented Mar 25, 2021

Luv.DNS.getaddrinfo ~family:`INET ~node:"google.com" () returns a function that's waiting for you to give it a callback. Only once it gets your callback, will it actually start working on the query. The REPL should have told you that the type here is a function.

This example from the docs show how to pass a callback as the last argument to Luv.DNS.getaddrinfo. Once your callback gets called, you have to do some work to extract the actual result, also shown in the example.

There's also an issue about implementing a synchronous DNS API (#30), which would make all of this a bit less complicated.

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

No branches or pull requests

2 participants