Function type signature

If you know how to read lisp / scheme, the code is approximatively there

https://github.com/JuliaLang/julia/blob/master/src/julia-syntax.scm#L1061-L1070

and there https://github.com/JuliaLang/julia/blob/master/src/julia-syntax.scm#L1413-L1473

As stated, it seems it will push local one by one in func and unwrap / unpack to them from a unique arg kept in sig (need to be reviewed) If my lisp is not too much rusted in the parenthesis call stack ocean

In my opinion, implicit rules and irregularities should be avoided in principle, not only “for dummies” or beginners. (Actually, I’d say that your suggestion is uncommon; beginners often ask for more verbose help pages and hand-holding error messages, but prefer less verbose output about aspects that are difficult for them to understand and find just distracting or screen-cluttering, including type signatures.)

I think that a conflict in this particular case is that the definition of function methods is not really a subject for beginners. If I had to recommend some reading to someone who is starting to use Julia, I would definitely tell that person to read the section of the manual about functions, but leave the section about methods for later on. In the first steps of learning Julia, while struggling with more basic concepts, users can live without knowing methods and all their complications, defining different functions like foo_singleargument, foo_tuple for different inputs.

By the way, I think that this sentence in the section about methods also answers your original question:

There is nothing about the different output of methods that you found confusing, which I don’t actually know if it is an intended feature. But with that information, it should be sufficient to understand what was happening in the first place.

2 Likes

I think we could improve the printing for the implicit unnamed argument. I’m not sure I have a concrete suggestion, but it does seem like it might cause some confusion.

4 Likes

It most likely is. I’m an old timer. I’ve seen dozens of languages and programming paradigms. This means that I have multiple plausible explanations when I see something behaving unexpectedly. Verbosity allows to reduce the number of hypothesis. Sometimes, I don’t believe what I see, at least at the first glance. :slightly_smiling_face:

I really appreciate all the help I’m getting. I’ve been asking a lot of questions recently. Due to time constraints and my learning style, I have to keep writing my Julia code while I learn the language.

4 Likes

If no improvement is easily found, explaining this in the docs my be a solution
https://github.com/JuliaLang/julia/pull/36673

3 Likes