Skip to content

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

@danielpclark

Description

@danielpclark

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions