Bug 471017 - Functions in imported module must be fully qualified to get a reference
Summary: Functions in imported module must be fully qualified to get a reference
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Golo (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL: https://github.com/golo-lang/golo-lan...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-25 10:48 EDT by Thierry Chantier CLA
Modified: 2016-05-25 10:27 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Chantier CLA 2015-06-25 10:48:57 EDT
yloiseau commented on 1 Mar

To get a reference to a function defined in an imported module using the ^ operator, it must be fully qualified, contrary to its usage.

For instance, given the module:

module foo

function bar = -> "bar in foo"

and a module using it:

module baz
import foo

function main = |args| {
  println(bar())

  let fqn_ref = ^foo::bar
  println(fqn_ref())

  let ref = ^bar
  println(ref())
}

The direct call works as expected, as the fully qualified reference. But the last assignment yields a
NoSuchMethodException: bar in class baz, which seems counter intuitive since it is “visible in the local scope” (or act as if).
Comment 1 Thierry Chantier CLA 2015-06-25 10:49:59 EDT
yloiseau commented on 5 Mar

Is this a feature? :wink:

--------------------------------------------
jponge commented on 5 Mar

No, feel free to fix it :smile:

--------------------------------------------
yloiseau commented on 5 Mar

Ok, I'll try to have a look...

--------------------------------------------
jponge commented on 5 Mar
Great!

--------------------------------------------
yloiseau commented on 5 Mar

Just wanted to be sure that it's not on purpose (performances or explicitness) that imported modules are not looked up for function references :smile:

--------------------------------------------
jponge commented on 6 Mar

Because the bootstrap method yields a constant call site, you need to look into the caller module imports. Same for #248

--------------------------------------------
yloiseau commented on 6 Mar

yep, it's the path I'm investigating

--------------------------------------------
yloiseau commented on 6 Mar

not as trivial as I first thought :smile: