argotorg / argotorg/fe

Support default initialization value for contract and struct fields? `x: u8 = 10`

Open
#290 3 comments 0 reactions 0 assignees View on GitHub
comp: parser type: ui/ux
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 7h
Merged PRs (30d)
6

Description

### What is wrong?

It's not possible to initialize a state field upon declaration. E.g. the following does not work.

```
contract Bar:
foo: u256 = 0
```

However, the error received is very cryptic and doesn't give the user the info they need.

```
Error: at line 6 col 0, expected ENDMARKER token:
contract Bar:
^
```

### How can it be fixed

Not sure, errors are all still very rough. Just wanted to write this down to not forget about.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or entry points and says the desired fix is undecided. Start by tracing how contract and struct field declarations are parsed and how the shown ENDMARKER diagnostic is produced; define the supported initialization syntax and an actionable error or behavior before implementing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.