Comments (10)
Auto-vars might actually be pretty useful.
from onyx-lang.
This explanation is difficult to follow. And even after following it, I don't see the point. The '
suffix is used in mathematics because there is no implied sense of the passage of time:
a = a + 1 -- total nonsense in mathematical terms
a' = a + 1 -- the suffix is needed to indicate a change is occurring, rather than an assertion
In programming, this is not needed:
value = some-calculation
value = value.some-further-processing
puts value
In the case of wrapped functions, as in your second example, I personally suffix an underscore. Ruby example:
def print(hash)
print_(hash, 0)
end
private def print_(hash, indent_level)
hash.each do |k,v|
case v
when Hash, Array
puts "%s: " % k
print_(v, indent_level+1)
else
puts "%s: %s" % [k,v]
end
end
end
Also, sometimes it's better to make it a nested function, or an anonymous function. Speaking of which, it'd be handy to be able to recurse an anonymous function. We'd need a keyword (a la super
) or some kind of lexical reference, that means "the current function":
->(){
.() # infinite recursion
}.()
from onyx-lang.
In programming, this is not needed
Those derived values are all used subsequently. The imperative mutating example you show doesn't counter that use example. I write zillions of lines of code like that in series analysis, where there are often derived series from others with slight variations that occur again and again, and where tacking on name-suffixes makes little sense or help.
In the case of wrapped functions, as in your second example, I personally suffix an underscore.
That's a valid approach. I don't think it looks better or clearer though.
Further discussion on anon self reference should go into it's own issue.
from onyx-lang.
derived series from others with slight variations that occur again and again
Then I'm afraid I don't really understand the problem we're trying to solve.
from onyx-lang.
Exactly what I described in the examples? :-P
from onyx-lang.
Yet other examples where "pretty much the same thing" is needed, the very idiomatic "assign to local to lock the state for flow inference":
type Foo
@foo Int32? 'get 'set
@bar Str? 'get 'set
do-some-shit() ->
if foo' = foo && bar' = bar
do-stuff-with foo', bar'
foo'.more-stuff bar'
end
end
end
Not necessarily an argument for '
specifically, but for the ability to have a character to de-facto signify such uses.
from onyx-lang.
I still don't understand the problem we're trying to solve here.
from onyx-lang.
Get a good way of naming the temp, derivative or main-impl, etc. commonly reoccurring constructs where a new var/func is needed, but it's not really something that reasonably should be named differently.
Like you solve it with foo_
. (That is common for initialization lists in C++ also, and sometimes instance vars - different style guides). So simply something that does have such a connotation (which prime has) rather than using, for instance, underscore.
I think it would be a helpful feature for some idiomatic patterns.
from onyx-lang.
Btw, the real prime character (′
) isn't supported in any of the popular monofonts (when I tried on google fonts) :-(
from onyx-lang.
Well, this will definitely be a go. It's super-useful. And some syntax to do auto-var-naming: if (foo?.stuff?.here?)' and (qwo())' then use(foo-stuff-here', qwo')
from onyx-lang.
Related Issues (20)
- Is this still being maintained? HOT 1
- Idea: replacing `+=` etc. with the canonical "self-call-assign" HOT 4
- Feature: terse array literals HOT 1
- Taking a look at how to effectively further the project HOT 5
- Request: Tagged unions HOT 3
- GUI in ONYX ? HOT 2
- [Question] Does this language has reader macros implemented and supports template programming? HOT 2
- Ditch Global Variables from the Language (Use Type Scoped Vars for Those Cases) HOT 4
- `Self` and `this` vs Other Namings HOT 3
- Feature: spread operator HOT 4
- Dead? HOT 4
- So it's dead then? HOT 3
- `in` operator HOT 1
- Tool: Stylizer / Formatter
- Type Reasoning Keywords HOT 20
- Anon function self-reference syntax HOT 1
- "Route '66 Style"* Syntax For Code Blocks (Braces) HOT 18
- Syntax Flow, Unresolved Ideas - Suggestions Welcome HOT 2
- Write Documentation for Onyx Lang HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onyx-lang.