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

Deal with namespace collisions for columns and Dataframe functions #2

Open
charlesgregory opened this issue Sep 9, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@charlesgregory
Copy link
Collaborator

For now we prevent compilation with specified function names as column names.

static foreach(i,member;memberNames){
static assert(member.stringof != "length");
static assert(member.stringof != "shape");
static assert(member.stringof != "copy");
static assert(member.stringof != "columns");
static assert(member.stringof != "sort");
static assert(member.stringof != "head");
static assert(member.stringof != "toString");
static assert(member.stringof != "unique");
static assert(member.stringof != "records");
mixin("alias "~member.stringof~" = getCol!\""~member.stringof~"\";");
}

This code allows to retrieve a column like this df.col. We want to avoid situations where df.length as a column collides with length property function.

@property ulong length(){
return records.length;
}

@charlesgregory charlesgregory added the enhancement New feature or request label Sep 9, 2020
@jblachly
Copy link
Member

jblachly commented Sep 9, 2020

should you in some, or all, cases add a prefix char like _ to avoid collision. for example, df._length ?

@charlesgregory
Copy link
Collaborator Author

I think that's reasonable solution as long as its consistent for all columns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants