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

Methods calling methods within methods! macro fail because parameter requirements #74

Open
danielpclark opened this issue Sep 13, 2017 · 0 comments

Comments

@danielpclark
Copy link
Contributor

danielpclark commented Sep 13, 2017

Now that I know this I can implement my code so it will work around this issue, but it's not convenient and I don't see any info on this. Consider this more of a documentation request.

Here's the scenario:

methods!(
  FasterPathname,
  _itself,

  fn r_dirname() -> RString { pub_dirname(r_to_path()) }
  fn pub_dirname(pth: RString) -> RString {
    Boolean::new(
      Path::new(
        pth.ok().unwrap_or(RString::new("")).to_str()
      ).is_dir()
    )
  }
);

And the method r_to_path simple gets the instance variable @path. When I try to run the above code I get errors that both the pub_dirname method call and r_to_path method call need three parameters. When I throw in some random values it tells me that the signature for those parameters need to be:

i32, *-ptr, FasterPathname

Even with methods that take extra parameters it still says three and asks for this same signature. So I'm assuming the methods! macro isn't allowing methods to be calling each other from within the methods! macro. I'll be moving all of my code out of it externally to implement both of my public/private alternative implementations that respectively work with or without the instance variable @path.

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

1 participant