Scryer-prolog: Rust questions/issues

Created on 23 May 2020  路  3Comments  路  Source: mthom/scryer-prolog

  1. Why is &Vec<T> used in function argument instead of &[T]? Example in this line, it also occurs in other places.

  2. Why is &Vec<T> used in the trait Allocator instead of &[T]? Line
    Does this mean this method can extend/shrink the last argument?

  3. Are some types supposed to implement Copy? Like Addr which implements Copy but there are some clone operations.

Most helpful comment

  1. That's a holdover from when I started this project. I was only beginning to learn Rust. I agree, there's no good reason not to pass a slice in those cases.

  2. mark_var can push instructions into the last argument, yes.

  3. Addr only recently implemented Copy. Consequently there are some still vestigial clone operations lying around.

All 3 comments

  1. That's a holdover from when I started this project. I was only beginning to learn Rust. I agree, there's no good reason not to pass a slice in those cases.

  2. mark_var can push instructions into the last argument, yes.

  3. Addr only recently implemented Copy. Consequently there are some still vestigial clone operations lying around.

OK and

Why is &Vec used in the trait Allocator instead of &[T]?

But even for trait Allocator &Vec<T> doesn't seem required, &[T] seem better.

This seems to be a good first issue.

Yes, there's no reason to prefer &Vec to &[T].

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XVilka picture XVilka  路  3Comments

triska picture triska  路  4Comments

triska picture triska  路  3Comments

XVilka picture XVilka  路  3Comments

mkohlhaas picture mkohlhaas  路  3Comments