1. I agree: I don't think there's anything specifically for
variables/types. However, type constructors are usually defined in/near the
type and *are* functions, so you can use @which on the constructor for the
type to get close. The output of `methods` also includes location
information, so that's another way to look at constructor locations.

5. There's probably a better resource somewhere for this, but HttpParser.jl
is an example of a Julia wrapper for a C library. (relevant file:
https://github.com/hackerschool/HttpParser.jl/blob/master/src/HttpParser.jl)
I picked it because I'm familiar with it. It has two Julia types that model
C structs from Joyent's httpparser library. These types are passed into the
C functions as Ptr{Parser} and Ptr{ParserSettings}, where Parser is a Julia
type modeling a C struct.

-- Leah


On Sun, Jan 12, 2014 at 8:48 PM, John Myles White
<[email protected]>wrote:

> 1. I think this is not possible, but I might be wrong.
>
> 2. Tuples have gotten a lot more efficient recently. Others will have to
> comment more on their relative merits vs. immutable composite types, which
> I prefer for explicitness and simpler integration with the dispatch system.
>
> 3. No idea about this. 90 MB isn’t much of an issue for the kind of work I
> do.
>
> 4. Blah{A} is a family of types, each of which is different for a specific
> value of A. The untyped version type Blah; a; end has a single type: its
> `a` field always has type Any, which is never tightened in response to data.
>
> 5. I think this is possible, but don’t know for sure.
>
> 6. Documentation is a major issue that should move forward in the next few
> months. Right now it is not possible to integrate your own functions with
> the help system.
>
> Hope that helps. Others will probably expand on my answers.
>
>  — John
>
> On Jan 12, 2014, at 6:39 PM, Andy M <[email protected]> wrote:
>
> > I've been following and experimenting with Julia for a little while now,
> and I have encountered questions that I haven't managed to answer by
> reading or googling. An answer to any of them would be greatly appreciated.
> >
> > 1. Is there any way to retrieve the location of the definition of a
> variable or a type? I know I can use @which to find method definitions, but
> that's all I know how to find.
> >
> > 2. Are tuples are less memory efficient than immutable composite types?
> If so, why is this? I got the impression that they are after reading
> various different articles and comments, so maybe I have just misunderstood
> something.
> >
> > 3. Why is Julia's memory usage so high? When I open the interpreter (in
> linux) it stabilises around 90MB. If I call Pkg.installed(), it jumps to
> 165MB, and stays there. Calling gc() doesn't reduce it either. Is it an
> inevitable consequence of the language's design? Or perhaps an issue that
> is being worked on? Or is it just not that important to the language's
> target users?
> >
> > 4. The documentation suggests that "type Blah; a; end" is less efficient
> than "type Blah{A}; a::A; end". If so, why does the former not default to
> the behaviour of the latter? Is it to avoid excess code generation? Or
> perhaps the latter representation has some undesirable behaviour?
> >
> > 5. Is it currently possible to pass a struct to a C function? I found
> documentation saying that it isn't possible, but there are github issues
> which suggest the problem has been worked on.
> >
> > 6. Is there a way to document a function, method, type, variable or
> module, such that the documentation can be retrieved in the interpreter? I
> mean something like javadocs or python docstrings. If not, is something
> like this going to be added?
> >
> > Sorry for asking so many questions all at once. I am considering
> starting quite a big project in Julia, and I think my timezone has made it
> difficult to find help in the IRC channel.
>
>

Reply via email to