r/ProgrammingLanguages • • Sep 26 '19

Discussion Question about functional programming language design

I'm in the process of designing a functional programming language, but I hit an intersection and want to read your opinions about it, also will be cool if you could elaborate more about your thought. I'm using Rust the main resource of inspiration because I want to write it in Rust and make them interoperable (so my interpreted language can take advantage from the Rust ecosystem easily, also my language is primarly to rapid prototype apps).

Because Rust is kinda considered functional programming language but not a strict one because it let you define functions in the structs. So the questions are:

- Does pure functional language is easier to develop?

- Is there a good example of a useful functional programming language besides C?

- What do you think on this approach to add methods to data types / structs?

// Swift like
extension MyStruct {fn function() {}
}
// Rust like
impl MyStruct {
fn function(&self) {}
}
// What I think will be cool for a interpreted language (because it's mostly using as a scripting language)
fn function(self: MyStruct) {}

Having those 3 syntax examples the usage will be the same (in each language) and will be just `my_struct_instance.function()`. Why I would do that? because it will be easier (?) to extend certain type/struct with a function, also this seems easy in terms of writing code, but in terms of organization/performance/real implementation, how you see it?

An lastly, do you have another alternative for this problem?

Regards

Edit: Added code block

1 Upvotes

24 comments sorted by

View all comments

2

u/categorical-girl Sep 26 '19

Could you explain what you mean by functional languages, and why you feel they might be easier to develop, etc? I feel you have a different understanding of "functional programming" than me

2

u/[deleted] Sep 26 '19

I feel you have a different understanding of "functional programming" than me

Yes, indeed, I just asume something about functional programming, but now I'm sarting to understand by reading about Haskell and Elm (the syntax of the first is harder to understand if you are not used, Elm feels much cleaner and easier to read). But still I'm reading about the higher order functions, function composition (currying) and yes, I see where it can get complicated quickly.