feat: native unit support
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**BEFORE**:
```python
# Native unit support
velocity = 5 m/s
force = 10 N = mass * acceleration
energy = 3 kJ -> eV # Unit conversion
def calculate_momentum(mass: kg, velocity: m/s) -> kg*m/s:
return mass * velocity
```
**AFTER**:
```python
# After (transpiled.py)
from vyper.units import Unit, Quantity
from typing import Any
def calculate_kinetic_energy(
mass: Quantity,
velocity: Quantity
) -> Quantity:
mass_val = mass.to('kg').magnitude
velocity_val = velocity.to('m/s').magnitude
return Quantity(0.5 * mass_val * velocity_val**2, 'joule')
result = calculate_kinetic_energy(
mass=Quantity(20, 'kg'),
velocity=Quantity(10, 'm/s')
).to('kJ')
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.