Open-source graph database, built for real-time streaming data, compatible with Neo4j.
Go to file
Lovro Lugovic 017dec8c0e LCP: Refactor the type representation
Summary:
# Summary

## Concepts and terminology

A **namestring for <object>** is a Lisp string that names the C++ language element
`<object>` (such as a namespace, a variable, a class, etc.). Therefore we have a
"namestring for a namespace", a "namestring for a variable", etc.

A **designator for a namestring for <object>** is a Lisp object that denotes a
"namestring for <object>". These are symbols and strings themselves.

A **typestring** is a Lisp string that represents a C++ type, i.e. its
declaration.

A **typestring designator** is a Lisp object that denotes a typestring.

A typestring (and the corresponding C++ type) is said to be **supported** if it
can be parsed using `parse-cpp-type-declaration`. This concept is important and
should form the base of our design because we can't really hope to ever support
all of C++'s type declarations.

A typestring (and the corresponding C++ type) that is not supported is
**unsupported**.

A **processed typestring** is a typestring that is either fully qualified or
unqualified.

A C++ type is said to be **known** if LCP knows extra information about the type,
rather than just what kind of type it is, in which namespace it lives, etc. For
now, the only known types are those that are defined within LCP itself using
`define-class` & co.

A C++ type is **unknown** if it is not known.

**Typestring resolution** is the process of resolving a (processed) typestring
into an instance of `cpp-type` or `unsupported-cpp-type`.

**Resolving accessors** are accessors which perform typestring resolution.

## Changes

Explicitly introduce the concept of supported and known types. `cpp-type` models
supported types while `unsupported-cpp-type` models unsupported types.
Subclasses of `cpp-type` model known types. `general-cpp-type` is either a
`cpp-type` or an `unsupported-cpp-type`.

Add various type queries.

Fix `define-rpc`'s `:initarg` (remove it from the `cpp-member` struct).

Introduce namestrings and their designators in `names.lisp`.

Introduce typestrings and their designators.

Introduce **processed typestrings**. Our DSL's macros (`define-class` & co.)
convert all of the given typestrings into processed typestrings because we don't
attempt to support partially qualified names and relative name lookup yet. A
warning is signalled when a partially qualified name is treated as a fully
qualified name.

The slots of `cpp-type`, `cpp-class`, `cpp-member` and `cpp-capnp-opts` now
store processed typestrings which are lazily resolved into their corresponding
C++ types.

The only thing that instances of `unsupported-cpp-type` are good for is getting
the typestring that was used to construct them. Most of LCP's functions only
work with known C++ types, i.e. `cpp-type` instances. The only function so far
that works for both of them is `cpp-type-decl`.

Since "unsupportedness" is now explicitly part of LCP, client code is expected
to manually check whether a returned type is unsupported or not (or face
receiving an error otherwise), unless a function is documented to return only
`cpp-type` instances.

A similar thing goes for "knowness". Client code is expected to manually check
whether a returned type is known or not, unless a function is documented to
return only (instances of `cpp-type` subclasses) known types.

## TODO

Resolution still has to be done for the following slots of the
following structures:

-   `slk-opts`
    -   `save-args`
    -   `load-args`

-   `clone-opts`
    -   `args`
    -   `return-type`

Reviewers: teon.banek, mtomic

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1962
2019-05-10 16:18:31 +02:00
cmake Remove Cap'n Proto 2019-05-08 10:51:10 +02:00
config Implement full durability mode 2018-08-29 16:05:07 +02:00
customers Implement manage script for card fraud demo 2018-02-12 13:29:12 +01:00
docs Migrate to Clang 8 2019-04-19 12:34:50 +02:00
environment Migrate to Clang 8 2019-04-19 12:34:50 +02:00
experimental Integrate code coverage with Apollo 2018-01-15 12:20:11 +01:00
libs Remove Cap'n Proto 2019-05-08 10:51:10 +02:00
poc Clean utils folder (namespaces, function names) 2018-04-22 09:44:32 +02:00
release Add backpacking tutorial 2019-04-11 09:48:56 +02:00
src LCP: Refactor the type representation 2019-05-10 16:18:31 +02:00
tests LCP: Small test fixes 2019-05-10 16:10:17 +02:00
tools LCP: SLIME debugging support when used as a tool 2019-05-10 16:09:28 +02:00
.arcconfig arcconfig: Default to master for diff and land 2017-11-07 18:41:51 +01:00
.arclint Add basic support for arc lint with clang-tidy 2019-04-23 15:51:36 +02:00
.clang-format Edges data structure now supports multiple edge filtering (implicit OR) 2017-09-26 13:46:18 +02:00
.clang-tidy Enable more checks in clang-tidy 2019-05-07 09:38:25 +02:00
.gdbinit Add pretty printer to gdb for TypedValue 2017-08-16 11:32:25 +02:00
.gitignore Remove Cap'n Proto 2019-05-08 10:51:10 +02:00
.ycm_extra_conf.py Add kafka library and integrate it into memgraph 2018-07-06 15:52:23 +02:00
apollo_archives.py Refactor Apollo build projects 2018-03-27 13:47:18 +02:00
apollo_archives.yaml Polish Bolt client and mg_client 2018-10-19 13:55:51 +02:00
apollo_build.yaml Use new toolchain for parent diff build 2019-04-23 13:07:20 +02:00
CHANGELOG.md Add recovery and GraphDbAccessor interface for UniqueLabelPropertyConstraint 2019-03-27 12:33:56 +01:00
CMakeLists.txt Remove Cap'n Proto 2019-05-08 10:51:10 +02:00
Doxyfile Add initial version of Apollo config files 2018-01-10 14:46:10 +01:00
Doxylogo.png Doxygen setup 2016-12-20 15:49:52 +01:00
init Quickload lcp and lcp/test to avoid any missing dependencies 2019-05-09 15:44:55 +02:00
README.md Migrate command line args to gflgs in tests 2017-07-06 13:54:12 +02:00

memgraph

Memgraph is an ACID compliant high performance transactional distributed in-memory graph database featuring runtime native query compiling, lock free data structures, multi-version concurrency control and asynchronous IO.

dependencies

Memgraph can be compiled using any modern c++ compiler. It mostly relies on the standard template library, however, some things do require external libraries.

Some code contains linux-specific libraries and the build is only supported on a 64 bit linux kernel.

  • linux
  • clang 3.8 (good c++11 support, especially lock free atomics)
  • antlr (compiler frontend)
  • cppitertools
  • fmt format
  • google benchmark
  • google test
  • glog
  • gflags