# re:Flex Smart Contract Language

To enable the development of expressive, composable smart contracts that can be seamlessly integrated into dApps, Flex introduces re:Flex, a novel smart contract language designed from the ground up for the FVM. re:Flex is a statically-typed, functional programming language that combines the familiarity and ecosystem compatibility of Solidity with the safety and expressiveness of modern language features.

Properties of re:Flex include:

1. Type system: A strong, static type system that catches common programming errors at compile-time and provides a solid foundation for building secure and reliable contracts.
2. Functional programming: Embraces functional programming principles to promote code reuse, modularity, and testability.
3. Contract composition: First-class support for contract composition, allowing developers to create modular, reusable building blocks that can be easily combined to form complex dApps. Contracts in re:Flex can inherit from one or more base contracts, inheriting their state variables, functions, and modifiers. This enables the creation of contract hierarchies and the reuse of common functionality across multiple contracts.
4. Safe arithmetic: Integer overflows and underflows are a common source of vulnerabilities in smart contracts. To prevent these issues, Reflex provides safe arithmetic operators that automatically check for overflows and throw an exception if an operation results in an out-of-bounds value.
5. Access control: Includes built-in primitives for implementing access control and authorization in smart contracts. Contracts can define roles, which represent a set of permissions or capabilities that an address can possess. Roles can be granted, revoked, and checked using dedicated language constructs, such as the \`auth\` and \`has\` keywords.
6. Error handling: Provides a robust error-handling mechanism based on exceptions. Contracts can define custom exception types and throw them using the \`throw\` keyword.
7. Metaprogramming: Powerful metaprogramming capabilities that enable developers to write code that generates or manipulates other code at compile-time.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flexecosystem.gitbook.io/flex-docs/protocol/technical-roadmap-for-the-flex-ecosystem/re-flex-smart-contract-language.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
