Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upMake instance naming optional #952
Comments
This comment has been minimized.
This comment has been minimized.
|
The compiler used to do this, but the names were so ugly that they made the code practically unreadable at times. Making them optional is an interesting option. |
This comment has been minimized.
This comment has been minimized.
jdegoes
commented
Mar 11, 2015
|
|
This comment has been minimized.
This comment has been minimized.
|
In the context of the C++11 backend, the instance names aren't used, so I've also been thinking optional names would be nice. I can't speak to what effect it would have in JS, or on the error messages. Would a simple hash (if optional and not provided) work without negatively affecting much? It seems that as long as the error messages include line numbers it would be ok, but I'm not an expert on it. |
This comment has been minimized.
This comment has been minimized.
|
I'd say it depends on what you're wanting out of the backend. If you want to generate code that others will still use, then optional names is a bad idea. If you don't care what people do with the generated code, then enforcing names is a good thing. Since the current js backend still wants people to read the output, keeping names mandatory is a good idea. If a different backend (could still be js, could be C++11) didn't care about readable output, then names wouldn't even be necessary. |
This comment has been minimized.
This comment has been minimized.
|
Not another argument for or against, but just to clarify: in the C++11 backend, the instance names do not appear at all in the generated code. Also to clarify: readable generated code is definitely still a goal of the C++11 backend. |
This comment has been minimized.
This comment has been minimized.
user471
commented
Jul 18, 2015
|
I also would like to see this feature. Compiler can just generate guid. If someone needs a instance name he can simply add it. Why to force people to do something if they don't need it. |
This comment has been minimized.
This comment has been minimized.
|
I'm of course a |
paf31
closed this
Aug 8, 2015
This comment has been minimized.
This comment has been minimized.
|
Why was this closed? |
This comment has been minimized.
This comment has been minimized.
|
I closed it because this is one of a few issues which seem to crop up every few months. The only reason for it seems to be that it's a mild inconvenience to choose and type a name, and I can think of three reasons against:
I generally like to leave these things open for discussion, but we don't seem to be able to reach a consensus, and at some point, a decision has to be made. I don't think it's worth it, sorry. |
This comment has been minimized.
This comment has been minimized.
jdegoes
commented
Aug 8, 2015
|
I think this is the best decision. Seriously, we probably spent more time on this ticket than any of us will spend writing instance names in a whole lifetime. |
This comment has been minimized.
This comment has been minimized.
user471
commented
Aug 8, 2015
What if ps will become popular? Then thousands programmers will write this useless names. |
This comment has been minimized.
This comment has been minimized.
|
Locking this, discuss it on IRC if you like. |
dvdsgl commentedMar 10, 2015
I apologize if this issue has already been discussed ad nauseum, and I'm sure the reasoning behind instance naming is robust, but I need to share my experience:
After adding 50 instance declarations to my app over the past few days, none of which I plan to reference from JavaScript, I felt like I was doing work that the compiler should be doing for me when writing down typeclass instance names. I'd really appreciate it if instance names were optional, so if I omit the name like:
Then the compiler comes up with some unique name for this that I never need to worry about. If I want to provide a name for any reason, I can continue to do so with the current syntax.