-
Notifications
You must be signed in to change notification settings - Fork 51
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
use data instead of fun so pattern-matching on def's is possible #8
base: master
Are you sure you want to change the base?
Conversation
The definition of the language demands that all functions defined as `data`
must be in the same module as the `cat` definition for their result type.
This is kind of like in Haskell.
The RGL has one Cat module which defines all categories and then the
functions are spread in several modules. This means that using `data` in
the RGL is against the language specification. However, I am not sure that
the compiler checks that restriction.
Best Regards,
Krasimir
…On 13 August 2018 at 21:45, bruno cuconato ***@***.***> wrote:
are there any drawbacks to these changes? (e.g., performance-wise?) I
found that several constructs were already declared as data, but some
were not.
------------------------------
You can view, comment on, or merge this pull request online at:
#8
Commit Summary
- - use data instead of fun so pattern-matching on def's is possible
File Changes
- *M* src/abstract/Adjective.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-0>
(3)
- *M* src/abstract/Conjunction.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-1>
(2)
- *M* src/abstract/Noun.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-2>
(4)
- *M* src/abstract/Sentence.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-3>
(2)
- *M* src/abstract/Structural.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-4>
(2)
- *M* src/abstract/Tense.gf
<https://github.com/GrammaticalFramework/gf-rgl/pull/8/files#diff-5>
(2)
Patch Links:
- https://github.com/GrammaticalFramework/gf-rgl/pull/8.patch
- https://github.com/GrammaticalFramework/gf-rgl/pull/8.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ATBZZGhmbpl4gtO6P2UW7rLdLSLNVKXnks5uQddrgaJpZM4V7HPg>
.
|
@krangelov thanks for the answer! when you say "in the same module" you mean literally in the same file, or would an extension (
it does, I tried adding |
No extension is not an option. If you allow data types to be extended then
we should also make it possible to extend def rules. This would be a nice
feature but it is not a trivial extension.
…On 15 August 2018 at 13:50, bruno cuconato ***@***.***> wrote:
@krangelov <https://github.com/krangelov> thanks for the answer!
when you say "in the same module" you mean literally in the same file, or
would an extension (**) of that file also work? if the later is fine,
this is why this PR seems work alright (not only the CI build, but I've
been using this patch now). if so, can we merge this? (as I said, these are
not the only data declarations, the RGL is already full of them!)
However, I am not sure that the compiler checks that restriction.
it does, I tried adding data the grammar I was developing and got an
error!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATBZZAQzXs01CA8yW_tqG0Xx7xbnGaEnks5uRAsUgaJpZM4V7HPg>
.
|
sorry, I wasn't very clear: I meant extended modules, not extended types! i.e., the RGL has several cases of |
misclicked the close button, sorry. |
@krangelov So what was the conclusion, does "against the language specification" mean that we should not merge this, or do we not care? |
I think it is better not to merge it. Anyway if you want to pattern match
on trees it is so far simpler to do it outside GF.
…On 21 August 2018 at 13:42, Inari Listenmaa ***@***.***> wrote:
@krangelov <https://github.com/krangelov> So what was the conclusion,
does "against the language specification" mean that we should not merge
this, or do we not care?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATBZZI6nIxDqJav06rjpPYOXvn3bQvimks5uS_I-gaJpZM4V7HPg>
.
|
@krangelov should I make a PR removing the existing instances of this problem?
yes, but at the cost of another dependency.. |
My opinion on this old question is: a) one might want to define a tree normalization nf : trees -> trees, e.g. to transform trees with possessive genitive attribute, PossNP cn np, to trees with attributive possessive pronoun, DetCN (DetQuant (PossPron pron) num) cn, in case np is a (UsePron pron). The data constructors in the RGL are in Noun, Numeral, Sentence, Verb with result types like Card, Digit, Numeral Cl, VP etc. that are defined in Cat. So, clearly the compiler does not enforce the restriction of C.3.6 mentioned by Krasimir. |
are there any drawbacks to these changes? (e.g., performance-wise?) I found that several constructs were already declared as
data
, but some were not.