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

option/questionmark equivalence #206

Open
skrah opened this issue Jan 10, 2016 · 2 comments
Open

option/questionmark equivalence #206

skrah opened this issue Jan 10, 2016 · 2 comments

Comments

@skrah
Copy link
Contributor

skrah commented Jan 10, 2016

I think this should probably be rejected by the parser:

parse("A * option[?int32]", symtable)
dshape("A * ??int32")

This one is rejected:

parse("A * ??int32", symtable)
Traceback (most recent call last):
[...]
datashape.error.DataShapeSyntaxError: Expected a dim or a dtype

I'm not sure if option/questionmark should be exactly equivalent.

@llllllllll
Copy link
Member

I think the real bug here is that ??A is rejected. imho this should be allowed.

@skrah
Copy link
Contributor Author

skrah commented Jan 13, 2016

Theoretically it should be allowed -- for example the ML type system allows it, too:

Poly/ML 5.2 Release

SOME (SOME 10);
val it = SOME (SOME 10) : int option option

But it probably doesn't occur in practice. dynd-python explicitly disallows it:

Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:16:01)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

from dynd import nd, ndt
a = nd.empty("A * option[?int32]")
Traceback (most recent call last):
File "", line 1, in
File "dynd/nd/array.pyx", line 800, in dynd.nd.array.empty (/home/travis/build/libdynd/dynd-python/build/temp.linux-x86_64-3.5/array.cxx:7592)
File "dynd/ndt/type.pyx", line 122, in dynd.ndt.type.type.cinit (/home/travis/build/libdynd/dynd-python/build/temp.linux-x86_64-3.5/type.cxx:1565)
TypeError: Cannot construct an option type out of ?int32, it is already an option type

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

No branches or pull requests

2 participants