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

fun as function keyword to line up code better #16

Open
samuell opened this issue May 2, 2024 · 3 comments
Open

fun as function keyword to line up code better #16

samuell opened this issue May 2, 2024 · 3 comments

Comments

@samuell
Copy link

samuell commented May 2, 2024

Small pet peeve: I never understood why Rust (not to mention Go) didn't go with fun as the keyword for functions, so that the function name lines up with four space indentation of the code below 😊

So instead of:

fn main() {
    let reader = bufio.NewReader(os.Stdin)

    rand.Seed(time.Now().UnixNano())
    let secret = rand.Intn(100) + 1
    // ... cont ...

We'd have:

fun main() {
    let reader = bufio.NewReader(os.Stdin)

    rand.Seed(time.Now().UnixNano())
    let secret = rand.Intn(100) + 1
    // ... cont ...
@AbstractiveNord
Copy link

AbstractiveNord commented May 4, 2024

If you are extremely careful about that alignment, consider using double spaces:

fn  main() {
    let reader = bufio.NewReader(os.Stdin)

    rand.Seed(time.Now().UnixNano())
    let secret = rand.Intn(100) + 1
    // ... cont ...

I don't recommend both of approaches since fn main() is OK, but you can propose that into fmt tool of Borgo. And don't take it too serious.

@kegsay
Copy link

kegsay commented May 7, 2024

I'm surprised you like that. To me, the alignment trips up my eyes so I see main as part of the function body, which of course it isn't. Having it offset makes line scanning easier in my brain.

@Chu-4hun
Copy link

Chu-4hun commented May 7, 2024

fn - is for functions
fun - is not fun

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

No branches or pull requests

4 participants