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

Wiki about apostrophes #292

Closed
kstarikov opened this issue Jul 21, 2016 · 3 comments
Closed

Wiki about apostrophes #292

kstarikov opened this issue Jul 21, 2016 · 3 comments
Assignees
Labels

Comments

@kstarikov
Copy link

In https://github.com/Frege/frege/wiki/LYAH-adaptions-for-Frege#babys-first-functions-subject-to-review-by-mmhelloworld :

In Frege, the apostrophe is only allowed at the end of a name

But in Frege repl (version 3.24.30) it looks as follows:

frege> conanOBrien' = "It's a-me, Conan O'Brien!"
function conanOBrien' :: String

frege> conanOBrien'
java.lang.NoSuchFieldException: conanOBrien'

By the way, having the apostrophe in the middle of the name leads to the same results:

frege> conanO'Brien = "It's a-me, Conan O'Brien!"
function conanO'Brien :: String

frege> conanO'Brien
java.lang.NoSuchFieldException: conanO'Brien

However, if I define it as a function with an argument, it works:

frege> conanO'Brien a = "It's a-me, Conan O'Brien!" ++ a
function conanO'Brien :: String -> String

frege> conanO'Brien "foo"
It's a-me, Conan O'Brien!foo
@Ingo60 Ingo60 added the bug label Jul 23, 2016
@Ingo60
Copy link
Member

Ingo60 commented Jul 23, 2016

This looks like a bug in the REPL, it also appears in the online REPL.

However,

conanO'Brian = "foo"
id conanO'Brian 

does work.

Needs more investigation.

@mmhelloworld
Copy link
Member

I am investigating on the REPL side.

@mmhelloworld
Copy link
Member

Ok, I am confirming that this is REPL bug. For conanOBrien', compiler is generating a field with name conanOBrien$tick. When we just evaluate the field with frege> conanOBrien', REPL is trying to evaluate the field value by looking up the field on the generated class using reflection with name conanOBrien' hence the NoSuchFieldException.

With conanO'Brien a function case and id conanO'Brian case, REPL is not directly interpreting conanO'Brien but the result of those expressions so these cases succeed.

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

No branches or pull requests

3 participants