Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

removed hard calls on json blobs #1094

Merged
merged 1 commit into from
Mar 5, 2019
Merged

removed hard calls on json blobs #1094

merged 1 commit into from
Mar 5, 2019

Conversation

ixv
Copy link
Contributor

@ixv ixv commented Mar 4, 2019

Stop harding json blobs in eyre; clam them instead. Mitigates the problem of eyre choking on large json blobs that landscape passes.

@ixv ixv requested a review from philipcmonk March 4, 2019 22:41
@ohAitch
Copy link
Contributor

ohAitch commented Mar 4, 2019 via email

@philipcmonk
Copy link
Contributor

We use "clam" to refer to irregular ,, which apparently expands to $; now. It's not a clam in the old sense of "don't crash", but it uses the same syntax and you use it in most of the same instances. It should be semantically equivalent to hard but faster. In practice, bugs.

@ixv ixv merged commit 4a66b93 into next Mar 5, 2019
@ohAitch
Copy link
Contributor

ohAitch commented Mar 5, 2019 via email

@philipcmonk
Copy link
Contributor

Equality check at the end. This can be very expensive.

"calling json as a gate" is equivalent to $;. It's just that "calling a mold as a gate" is a really bad syntactic antipattern, and I think it should be disallowed. It makes you have to think about why ((list [@ @]) ~) doesn't work. We can't at parse time distinguish a mold from a value, so we need to apply Philip's Comma Rule[0]. Much better to simply prefix all clams with , which has the added benefit of being more explicit about what you're doing.

[0] If (1) it's not a function (unlike pair), (2) you can't tell by context that it's a type (unlike the first argument to |= ), and (3) it's ambiguous as context-free as to whether it's a type (unlike * or @ or ^), then you need to prefix it with a comma.

@ohAitch
Copy link
Contributor

ohAitch commented Mar 5, 2019 via email

@philipcmonk
Copy link
Contributor

"You are not however allowed to call this gate"

I mean, calling it a gate has always been a lie, it's just a question of degree. You can't just do (,|=(* +<) 5) for example. OTOH you can do:

=+  m=|=(* ?^(+< +< +(+<)))  (,m 5)

It may be implemented as a gate somewhere deep down, but you shouldn't pretend it's just a gate to the user.

Unless 2019 clams are inconsistent about whether they'll crash on mistyped values

Bingo: ((list) [1 2 3 ~])

@ohAitch
Copy link
Contributor

ohAitch commented Mar 5, 2019 via email

@philipcmonk
Copy link
Contributor

> ((list) [1 2 3 ~])
~[0 0 0]
> (,(list) [1 2 3 ~])
~[0 0 0]
> ((list *) [1 2 3 ~])
~[1 2 3]
> ((list *mold) [1 2 3 ~])
~[1 2 3]
> (,(list ,*mold) [1 2 3 ~])
~[1 2 3]
> (,(list *mold) [1 2 3 ~])
[1 2 3 0]

@ohAitch
Copy link
Contributor

ohAitch commented Mar 5, 2019 via email

@philipcmonk
Copy link
Contributor

This is definitely a bug. As for whether all ++hard calls should turn into clams, the question is "do you trust that clams don't corrupt data, given that nobody's ever checked it very well and we know it does in at least one case"?

@ohAitch
Copy link
Contributor

ohAitch commented Mar 5, 2019 via email

@ixv ixv mentioned this pull request Mar 7, 2019
@jtobin jtobin deleted the remove-json-hard branch August 9, 2019 13:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants