|
|
I tried it once and quickly went back to JavaScript.
For years I thought TypeScript would fix all my JavaScript woes, but by the time I started using it I was so used to JavaScript that all the extra typing (like literal keyboard typing ) wasn't worth it
|
|
|
|
|
I have to agree. I have trouble wrapping my head around transpiling a language that I know and am comfortable with into, well, something else. For...reasons.
I'll be honest, though, using webpack for a little bit has sort of made me re-evaluate that thought process.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Exactly.
Although that's different for SCSS/SASS and CSS though
Now THAT is a must have!
|
|
|
|
|
I'll let the designers have their fun with that. For my money, I'll just snag BS or vuetify :/
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Nathan Minier wrote: vuetify Didn't know that one, but I do know Vue.
I'll have to look into that sometime (for the little front-end work I have to do)
|
|
|
|
|
It's a material design framework for Vue that brings teh sexy. If you setup the loaders right, it's not even terribly big after packing (in production mode, anyway).
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Nathan Minier wrote: I have trouble wrapping my head around transpiling a language that I know and am comfortable with into, well, something else.
I've taken on a strange view when it comes to javascript. It's basically a virtual machine with a very complex instruction set.
Looking at it that way, the familiar becomes new again. And then targeting javascript with other languages (see also, TypeScript, asm.js - the precursor to webassembly) makes more sense conceptually.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
JavaScript is a scripting language. It interacts with an interpreter, such as a browser or node.js. If you want to stretch things, it's similar to a runtime, not wholly dissimilar to .NET or JRE.
Ergo: JavaScript is to browser as C# is to .NET
Now, when I said that I can't "wrap my head around" using TypeScript, I'm basically saying that I don't know why I would want to use VB.NET instead of C#, when I'm already an expert at C#. Or worse, why I would write something in VB, transpile it into C#, and then evaluate it against the runtime.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
that is the traditional way to look at javascript, but i find it's not nearly enough to conceptualize it that way anymore, but then like i alluded to, asm.js influenced by thinking on that.
Nathan Minier wrote:
Now, when I said that I can't "wrap my head around" using TypeScript, I'm basically saying that I don't know why I would want to use VB.NET instead of C#, when I'm already an expert at C#
Well I can think of one reason in this case - type checking, but that doesn't hold to your analogy since both C# and VB.NET do it.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: Well I can think of one reason in this case - type checking,
Type safety is a compilation-level feature, as any bad cast will tell you very quickly. It has exactly zero impact on well-behaved code, it's just a development tool.
Coding against JS means handling type cases at runtime, which is the proper way to approach a duck type language.
I would argue that by trying to make the language look like something that it is not, TypeScript encourages bad code practices.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
That's an interesting argument. I don't necessarily agree but I do see where you're coming from.
But given my views on the JS/RTE as a "VM in disguise" we'll just have to disagree there.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
if you had a choice, would you rather port Typescript to C#, or javascript to C#?
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Why would I port them?
My front-end code would do absolutely nothing in back-end C#
|
|
|
|
|
i mean just in general.
as i said i ported a Splay tree function from typescript to C# and it went beautifully.
i was impressed by TS for that.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
In a complete hypothetical case that will almost never happen I would prefer to port TypeScript to C# rather than JavaScript.
But I'm not going to write all my front-end code in TypeScript in case I'll ever have to.
The only reason I'd use TypeScript is because some people really can't handle the dynamic nature of JavaScript.
So it's more a tool to "fix" the incompetence of others (I have a very specific someone in mind because I once had to use some JavaScript he wrote )
Who the hell has three different return types for a single function!?
|
|
|
|
|
Sander Rossel wrote: Who the hell has three different return types for a single function!?
Do you really have to ask me that? Who do you think would do something so diabolical?
Sander Rossel wrote: But I'm not going to write all my front-end code
A splay tree isn't front end specific and frankly I have no idea why someone wrote it in typescript.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: Do you really have to ask me that? Who do you think would do something so diabolical? Even you know better than that!
Despite your complete lack of code sanitation I actually hold you in pretty high regard
Don't get any ideas though, I'll still prick you with my pitchfork.
That sounded better in my head
honey the codewitch wrote: and frankly I have no idea why someone wrote it in typescript. Exactly my point!
|
|
|
|
|
Sander Rossel wrote: Despite your complete lack of code sanitation I actually hold you in pretty high regard
However, that will change when you see my C# ISAM database code.
In any case, you're being sweet. I won't hex you today.
As far as writing splay trees in typescript i guess one could ask why write a database engine in c#?
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
honey the codewitch wrote: why write a database engine in c# Why not? It does the job
honey the codewitch wrote: In any case, you're being sweet. I won't hex you today. Probably because it's weekend and I don't have the energy to be mean
honey the codewitch wrote: my C# ISAM database code You still wrote it though.
|
|
|
|
|
Sander Rossel wrote: You still wrote it though.
Am writing it. Trying to do B+ trees. And once i get them working for in-memory i have to make them diskable, and you can't just use serialization. You have to keep an open file pointer and seek periodically and read/write the blocks you need. It's that kind of file I/O, so i'm still a ways off. I hope to have the B+ tree at least solidly in progress by tonight but we'll see.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
here's the main render loop for Prang Replay, my midi looper for FL Studio
void _stdcall Replay::Gen_Render(PWAV32FS DestBuffer, int &Length) {
unsigned long long p = looper.pos;
int bts = looper.beats;
float bps = looper.tempo / 60;
float spb = looper.sampleRate / bps;
unsigned long long i = 0;
midi_message midi;
vector<Loop>& loops = looper.loops;
if (1 < loops.size() && looper.rol != looper.ror) {
if(looper.rol) {
loops.push_back(*loops.begin());
loops.erase(loops.begin());
if (-1 < looper.lastPushIndex) {
--looper.lastPushIndex;
if (0 > looper.lastPushIndex)
looper.lastPushIndex += looper.loops.size();
}
looper.rol = false;
}
if(looper.ror) {
loops.insert(loops.begin(), (*(loops.end() - 1)));
loops.pop_back();
if (-1 < looper.lastPushIndex) {
++looper.lastPushIndex;
if ((int)looper.loops.size() <= looper.lastPushIndex)
looper.lastPushIndex -= looper.loops.size();
}
looper.ror = false;
}
}
else
looper.rol = looper.ror = false;
if(looper.push) {
if (0xFFFFFFFFFFFFFFFF!=looper.tapPos) { unsigned long long len = p - looper.tapPos;
i = (unsigned long long)ceil(len / spb);
i = ((unsigned long long)ceil(i / bts))*bts; bts = (int)i;
if (0 == bts)
bts = looper.beats;
}
if (bts)
{
unsigned long long bp = p;
vector<midi_event>::iterator it = looper.events.end() - 1;
vector<midi_event>::iterator cur = it;
unsigned long long bl = (unsigned long long)(spb*bts);
unsigned long long bs = bp - bl;
if (looper.events.size()) {
while ((*it).pos > bs) {
--it;
if (looper.events.begin() == it)
break;
}
while (looper.events.end() != it && it->pos < bs)
++it;
}
Loop loop;
loop.eventIndex = 0;
loop.length = bl;
loop.pos = 0;
if (looper.events.size()) {
while (it <= cur) {
midi_event ev(*it);
ev.pos -= bs;
loop.events.push_back(ev);
++it;
}
}
loops.push_back(loop);
looper.hanging = looper.keyContext; looper.lastPushIndex = loops.size() - 1;
}
looper.push = 0;
looper.tapPos = 0xFFFFFFFFFFFFFFFF;
pEditor->ParamsToControls();
}
vector<Loop>::iterator it = loops.begin();
while (it != loops.end()) {
Loop& loop = (*it);
int lec = loop.events.size();
if (lec) {
while (loop.eventIndex >= lec)
loop.eventIndex -= lec;
unsigned long long n = Length + loop.pos;
int nc = 0;
while (true) {
unsigned long long lp = loop.events[loop.eventIndex].pos;
if (lp < loop.pos)
lp += loop.pos;
if(lp<n) {
midi = loop.events[loop.eventIndex].midi;
loop.noteCounter.process_message(midi);
looper.noteCounter.process_message(midi);
midi = looper.noteCounter.filter_message(midi);
if (looper.enabled && midi.status)
PlugHost->MIDIOut_Delayed(HostTag, (int)midi);
}
else break;
++loop.eventIndex;
if (loop.eventIndex >= lec)
loop.eventIndex -= lec;
++nc; if (nc == lec) break;
}
loop.pos += Length;
if (loop.pos > loop.length)
loop.pos -= loop.length;
} else
it->pos+=Length;
while (it->pos >= it->length)
it->pos -= it->length;
++it;
}
while ((size_t)looper.eventIndex < looper.events.size()) {
midi_event e(looper.events[looper.eventIndex]);
if (Length <= e.pos - p)
break;
looper.noteCounter.process_message(e.midi);
looper.incomingNoteCounter.process_message(e.midi);
midi_message m = looper.noteCounter.filter_message(e.midi);
if(looper.enabled && 0!=m.status)
PlugHost->MIDIOut_Delayed(HostTag, (int)m);
++looper.eventIndex;
}
if(looper.pop) {
if (loops.size()) {
Loop* ploop = &(*loops.rbegin());
for (int i = 0; i < 16; ++i) { for (int j = 0; j < 128; ++j) { looper.noteCounter.note[i][j]-=ploop->noteCounter.note[i][j];
if (looper.noteCounter.note[i][j] <= 0 && ploop->noteCounter.note[i][j] > 0) {
looper.noteCounter.note[i][j] = 0;
midi_message m;
m.extra = midiOut;
m.status = 0x80 | i;
m.data1 = j;
m.data2 = 0;
PlugHost->MIDIOut_Delayed(HostTag, (int)m); }
}
}
loops.pop_back();
}
if (looper.loops.size() == looper.lastPushIndex)
--looper.lastPushIndex;
looper.pop = 0;
}
looper.pos += Length;
Length = 0;
}
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
No - it's long gone.
Is it OK if I use one of yours, instead?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
use the above. It frightens animals and small children.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
No, but I remember what it was.
Duff's device laid on top of an if-else.
|
|
|
|