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

I miss pseudo :symbols from Imba1 #797

Open
madmaniak opened this issue Jan 23, 2023 · 8 comments
Open

I miss pseudo :symbols from Imba1 #797

madmaniak opened this issue Jan 23, 2023 · 8 comments

Comments

@madmaniak
Copy link
Member

Description

:symbol # => 'symbol'

It was really small feature but I loved to use it. Why to drop it?

Is this something you're interested in working on?

Yes

@familyfriendlymikey
Copy link
Member

Are you talking about these? https://imba.io/docs/grammar#identifiers-symbol-identifiers

@haikyuu
Copy link
Collaborator

haikyuu commented Jan 24, 2023

@familyfriendlymikey strings that don't contain spaces can bw written (in ruby and imba1) like this :mikey, which would compile to "mikey"
I know about this because I struggled with a piece of imba1 in the past and had to ask Sindre about it.
Rubyists are quite familiar with this, but not people coming from js land

@madmaniak
Copy link
Member Author

Let them write "mikey" and let rubyists write :mikey. No?

@haikyuu
Copy link
Collaborator

haikyuu commented Jan 26, 2023

@madmaniak I agree. I would use it too (now that I know what it is 😆)

One question though: what's the compiled output of this?

let c = a :b
  1. let c = {a:b}
  2. let c = a("b")

I think that's the main reason it was dropped and it would be too confusing to have a: b and a :b be so different

@madmaniak
Copy link
Member Author

Surely option 2 - you write : with b so it is applied to b. If you write together with a it applies to a. I've never seen someone would like to write like this - knowing that it normally compiles to option 1.

@haikyuu
Copy link
Collaborator

haikyuu commented Jan 26, 2023

Agree let's do it 💯 , and syntax highlighting helps with this (although @familyfriendlymikey doesn't use syntax highlighting)

It comes down to Sindre's opinion on it 😄

@haikyuu
Copy link
Collaborator

haikyuu commented Feb 15, 2023

There is another way, which I find a better fit for imba (Borrowed from lisp):

let name = 'Sindre

It starts with the quote so it's closer to a string and it behaves the same as rubys :name.

@madmaniak
Copy link
Member Author

Awesome.

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

3 participants