Replies: 6 comments 1 reply
-
there was a bit of informal discussion about this offline; i'll try to summarize it below. there seems to be a general agreement that i had a cursory look around the bs libraries and found some instances where example 1, from
rewriting this as
would seem natural (perhaps this is because of haskell, but then i guess most people who choose to use bs classic have at least some familiarity with haskell), but this would require example 2, from
in this case the parens look really out of place and it would indeed be nice to write instead
now this suggests that example 3, from your post:
now this would require so the two potential solutions are: A. make B. make from the offline discussion, there seems to be a general agreement that it would be preferable to write example 2 without the parentheses, and that for example 3 putting the left-hand-side in parens would be at least stylistically preferable and would make the code more readable. some folks have a preference for no parens in example 1 as well, while others don't seem to mind either way. personally, i would prefer both examples 1 and 2 without parens, and 3 with parens, meaning that i would vote for solution B. i guess this would mean making both if there is a consensus on this, perhaps we can leave this open for two weeks to allow any interested parties™ to comment and then make the change? meanwhile i'll see if i can add some parse tests for this that rely on things functioning as they are right now and should break if / when the precedence changes are made. |
Beta Was this translation helpful? Give feedback.
-
meanwhile, i also had a look at how but that's not all. because incidentally, in the current tree the prettyprinting is bugged as well (see #568), but this seems worth fixing with the fixity change. |
Beta Was this translation helpful? Give feedback.
-
Yeah agreed. After trying both alternatives in my code and thinking on your examples here, I am inclined to agree that setting the same precedence for $ and := (infixr 0) appears to be the more preferable choice. I feel like it aligns well with readability and intuition. Waiting a few weeks for additional opinions seems wise. The part about the implications on pretty-printing is interesting. I was unaware of all that. I am not sure I'll be able to make the change you're suggesting though, at least without some guidance. Is this something you would want me to attempt in my pull request? Thanks again for your attention to this! |
Beta Was this translation helpful? Give feedback.
-
So I looked at the source thinking I'd give you some pointers, and... I discovered that pretty-printing infix ops is actually broken altogether (#571). So it seems unfair to ask you to fix that as well :) I did, however, add some tests for Otherwise it seems nobody is objecting and we can merge the updated PR. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I appreciate that!
Happy to, but... , I may be missing something (I'm not very familiar with this repo), it seems that all 23 tests in
Sounds great to me. :-) |
Beta Was this translation helpful? Give feedback.
-
Ah, that was it! Thanks. Sorry, I'm still relatively new to life with git.
That all makes sense to me. (Thanks, this explanation was very helpful).
Ah! I was fooled by this quirk. Now that I know to look for it, it makes sense. Thanks again. Also, just thought I should mention:
Not sure what that was about, but it seemed to go away and come back a few times, and now I cannot make it come back to investigate further. |
Beta Was this translation helpful? Give feedback.
-
I made a pull request for this: #566
But I was curious what others have to say.
This only applies to the bluspec-classic (bluespec haskell?) language.
The precedence of the
$
and:=
operators are currently defined in Prelude.bs as:I would like to switch them to:
Things like this are not currently legal:
since they would be interpreted as this:
This change would have them interpreted as:
Making them legal.
What do you think?
Is there a good reason to keep the precedence as is?
The
:=
always just returnsAction
, right?So, It seems like the first form
fooReg := f a $ g b c
would never make sense currently.The second form, might make sense as
fnTakingAnAction $ f a b := 0
. But this seems rare?Maybe a better solution might be to set them both to the same precedence?
I'd love to hear other peoples thoughts on this.
Beta Was this translation helpful? Give feedback.
All reactions