Thread about the languages ( another one ? )

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
skip
Baaaaaa!
Baaaaaa!
Posts: 2455
Joined: Mon Sep 02, 2002 1:23 pm 0
Yahoo Messenger: oz_skip
Location: Adelaide, South Australia

Re: Thread about the languages ( another one ? )

Post by skip »

GoatFoam wrote:A fiver says you could pick them up again and be doing things within a week.
I think I'll struggle to go from AS2 -> 3....seriously :oops:

All but ASM might be doable. I only learnt it at uni for a couple of months about 20 years ago. Once it clicked, I did my exam, then promptly forgot it all into jugs of beer. Idiot!
User avatar
defsdoor
Baaaaaa!
Baaaaaa!
Posts: 3909
Joined: Fri Jan 30, 2004 12:26 am 0
Location: Sunny Beduff

Re: Thread about the languages ( another one ? )

Post by defsdoor »

My path was -
Z80 ASM
ZX Basic
6502 ASM
BBC Basic
68000 ASM
C
Wang Basic
KCML
8086 ASM
Seachange
Object Pascal (Delphi)
PHP
Ruby (RubyOnRails)
Java

In amongst all that I tried learning c++ and gave up on it - it seemed such a total mess. Then after playing with Delphi I realised that that was OOP.
I'm sure I've missed some stuff - but it's probably best forgotton - along with a whole rang of scripting tools. The only language that has endured though is C - I absolutely love it and have to satisify my C urges every now and then.
The Java is simply because of where I am now - my first impressions are that is it very much hard work - cretainly for what we are using it for here.

I would dearly love to improve my maths though - I'm trying to get back into learning opengl atm and am struggling.
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Thread about the languages ( another one ? )

Post by GoatFoam »

Got to admit I never really got into ASM on any platform. I have done bits and bobs here and there, mainly for things like implementing atomics on weird architectures but have never attempted to use it for anything non trivial.

Languages I can remember spending a decent amount of time with:

Commodore basic (vic 20)
BBC basic
STOS
GFA basic (seeing a trend here?)
Pascal (turbo variety)
C (borland)
C++ without properly working templates.
C with flat memory(!) Totally different beast :)
Python
C++ with templates that did work (makes life a lot less C like)
Erlang
Ocaml

For the last 10 years it's been mostly modernish c++ with some C.

Lots of others I have used a bit, but not enough to claim competence.
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

Re: Thread about the languages ( another one ? )

Post by Dio »

I squirm over (pre-C99) C nowadays, I hate declaration blocks. I was going declare-at-first-use even before I went C++, frequently using { } blocks just to declare new variables, but now I've been there I can't go back.
User avatar
Darkflame
Sheepie Whore
Sheepie Whore
Posts: 18236
Joined: Mon Mar 31, 2003 11:06 am 0
Location: Not the UK

Re: Thread about the languages ( another one ? )

Post by Darkflame »

Anyone had a go at Scala?

Got a big book sitting near me but I haven't given it a go yet.
Essentially seems a highly customizable Java....I think.

skip wrote:
GoatFoam wrote:A fiver says you could pick them up again and be doing things within a week.
I think I'll struggle to go from AS2 -> 3....seriously :oops:
I did awhile back, its not hard.

Then again, I forget and pick up languages again all the time. Wouldn't say I do anything very well, but I have never taken long to learn something in principle. Normally the effort to start learning is more then the learning itself.
I would dare to say add in this "many programmers never bothered/understood a shit about parallel programming".
I think these days its probably learnt in a sideways way from web coding. Doing anything even remotely complex in a webapp means getting assets or data from a server - firing off many requests independently which can come back at any time and in any order while the user is still doing stuff.
While you might not be doing true parallel processing on the cpu level, it does teach you at a lot of the same things.
User avatar
Barney
Baaaaaa!
Baaaaaa!
Posts: 2131
Joined: Tue Aug 23, 2005 7:59 pm 0
Location: UK, Broughton, Brigg

Re: Thread about the languages ( another one ? )

Post by Barney »

My path was as follows:

Sinclair BASIC
AMOS BASIC
Smartware II/DBASE III/Clipper
Delphi 1 to 3
x86 ASM
z80 ASM

Then I wrote a Sinclair BASIC interpreter in Delphi 2010 - and now I'm back to BASIC again for my day to day coding needs. Anything that can't be done in BASIC means I head back to Delphi to add the required functionality to the BASIC interpreter :)

The best thing about having learnt x86 ASM was being able to see from the disassembly what Delphi was trying to do, and from there being able to modify the pascal code to produce more efficient assembly code.

However, those days are pretty much behind me now that I'm back to BASIC again where I belong. I did a couple of ports of games in C and C++ but they're such god-awful languages... I still cannot figure out how to create a makefile - the biggest barrier to entry in C/C++ is actually getting the damned thing to even attempt to build your code, regardless of whether or not there are errors in your source. If that's where modern languages are going then I'm not interested :)
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
User avatar
gilesgoat
Sheepie Whore
Sheepie Whore
Posts: 27259
Joined: Wed Sep 03, 2003 7:54 am 0
Location: Monfalcone, Italy
Contact:

Re: Thread about the languages ( another one ? )

Post by gilesgoat »

gravy wrote:
gilesgoat wrote:Hope this clarifies a bit.
It's pretty much all old stuff and mostly imperative.

I must admit I'm with some of the other guys here in that wider exposure to other ways of doing things can have a really positive effect on the languages you do program.

It all depends about you relationship with programming I suppose, it's very different if coding is a means to an end or something you're genuinely enjoy for in itself.
It's what it was, old but still one of the most used languages.

I like some part of 'coding for the joy of coding' but overall to me coding is a way to obtain a result I have in mind, I have an idea I want to see it coming out coding is my tool to make that idea alive.

I'd feel quite bad if I'd spend time learning something that then maybe I can't use the get the results I have mind and/or the way I have in mind to reach them, however I am ready to learn everything if that everything is the thing that allows me to get the result I want.

Don't think anyway I am "so closed" as it may look like from what I wrote, this is just a part, I've seen many things in many forms but again one tends to 'stick' to what gives him/her the results one wants to see.

Plus C is love you know .. you can never forget/abandon what you love :wink:
Giles the billy goat
"Baa"
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6653
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: Thread about the languages ( another one ? )

Post by venusian »

Some ideas then.

For better cache usage a language could have a concept of working sets. The data within the set could be cache pinned . C gives you no mechanism to collect pieces of data into temporally related sets. It gives you no mechanism to mark data as heavily used in particular parts of the program and because in-memory layout is so haphazard it's hard to make optimal used of cache behaviour and pretty much impossible to do so portably. Some ISAs have prefetch and touch instructions but they don't have analogies in C.

If you're making sparse alterations to large data sets you might be better accessing them through a write-through cache. There's no mechanism for expressing this in C.

When C was invented the storage hierarchy was just disc->memory->register. Today it's network->disc->memory->cache->register, at least. The design of the language and it's standard libraries reflect the former but not the latter.

For massively threaded code, C's implicit stack makes for a page per thread overhead at least. A less heavily stack based language could make threading much more efficient.

Ooo execution is harder. Getting rid of C's willy-nilly aliasing might help compilers to generate better code. Flagging of first use and last use of values in the language might help. Tagging of the most common code path might allow ooo to extend over branches. It would certainly enable better instruction prefetching behaviour.

As is obvious I don't have a favourite language which solves everything. Rather it just seems to me that as a portable assembly language C is horribly out of date and is warping processor design. In the past I've worked on a dual-core machine with incoherent caches and a VLIW machine which required software directed dependencies for ooo execution. Both were very hard to target efficiently in C. The most recent one I worked on had C programmability as a key design aim which involved a trade-off with efficiency and ease of implementation.
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

Re: Thread about the languages ( another one ? )

Post by Dio »

Aliasing is a good example of where C++ limits what the compiler can do, sure.

Do you have any examples of where they do the cache bits in a language as high or higher level compared to C++?

Branch tagging is already done implicitly (the if branch should be the most likely branch) or by PGO; again, this seems like something problematic to specify in a language of C++ highness or more, because you're assuming an implementation.

The implicit stack... there's no need to write C or C++ code that uses the stack for anything beyond call or return, and I struggle to see a paradigm where those two primitives aren't going to be used in the implementation (indeed, as you go more high level than C++, stacks seem to become more important rather than less, in my limited experience).

And, again, I'm interested to read about examples of HLLs that allow for more efficient targetting of incoherent-cache architectures or software OOE dependencies. Surely, as soon as you are sitting above such a system, all HLLs become subject to similar restrictions? (I may be displaying my inexperience of the wider landscape of programming here, of course).
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6653
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: Thread about the languages ( another one ? )

Post by venusian »

Dio wrote:Do you have any examples of where they do the cache bits in a language as high or higher level compared to C++?
No, I don't but I don't think that's because it can't be done.
Dio wrote:Branch tagging is already done implicitly (the if branch should be the most likely branch) or by PGO; again, this seems like something problematic to specify in a language of C++ highness or more, because you're assuming an implementation.
I wasn't aware of the if(common)else(uncommon) convention (Is it in C99?). I don't understand how it assumes an implementation though - just adding the information is useful for the compiler but isn't dependent on the mechanism used to exploit it, surely?
Dio wrote:The implicit stack... there's no need to write C or C++ code that uses the stack for anything beyond call or return, and I struggle to see a paradigm where those two primitives aren't going to be used in the implementation (indeed, as you go more high level than C++, stacks seem to become more important rather than less, in my limited experience).
Anything lambda based is going to use a call/return stack but C, at least by convention, has a single stack for call/return and automatics. Here are a couple of ideas I've toyed with. (I'm not claiming to have invented anything here, btw, just been thinking about it).

- An implementation doesn't have to use a linear stack - one could use a cell based linked list to implement call/return, and everything else is allocated in standard sized chunks allocated off a different linked list. Then you don't need contiguous virtual space (and that in page sized increments) for threads and heap allocation doesn't cause fragmentation. Would work best with language level support. Also it allows call/return information to be separated from data so each can have a separate cache policy (i.e. you could exclude call/return from ever being cached thus increasing the proportion of your real data which fits in the first level cache, or the other way around.

- Lots of embedded designs are implemented as a number of threads running dispatch loops because this is encouraged by the C execution model which was in turn inherited from the UNIX process model. In fact many of these systems are either state machines or asynchronous event handlers - one could save memory and improve latency with a language which explicitly supports these models. In both cases the stacks' sizes can generally be statically calculated and are small and short lived. The ubiquitous Arm Cortex M processors have hardware features to support this but the ubiquitous language used with them can't explicitly express it.
Dio wrote:And, again, I'm interested to read about examples of HLLs that allow for more efficient targetting of incoherent-cache architectures or software OOE dependencies. Surely, as soon as you are sitting above such a system, all HLLs become subject to similar restrictions? (I may be displaying my inexperience of the wider landscape of programming here, of course).
Well, I've mostly been thinking about how one would design a low level or systems programming language which can use modern processor features rather than a higher level language. I'm not aware of any extant HLLs which address this but there that's not to say there aren't any.

Off the top of my head it seems to me that incoherent caches need some mechanism for marking use/commit blocks (so that data bars can be inserted) and specifying which functions are executed on which processor - something which can't easily be done in C because it no notion of separate threads of execution.

At the risk of repeating myself, I don't have solutions - I've just noticed that the systems I'm working on seem to be requiring more and more bending of the C model.
User avatar
tufty
Sheepie Whore
Sheepie Whore
Posts: 12524
Joined: Fri Jan 07, 2005 4:52 pm 0
Location: French Alps

Re: Thread about the languages ( another one ? )

Post by tufty »

Dio wrote:Do you have any examples of where they do the cache bits in a language as high or higher level compared to C++?
I'm doing specific ARMv6 cache hinting in my scheme->bare metal arm compiler. That's at the level of "start loading this stuff, we're gonna need it in a bit".

Indeed, it was trivially easy to implement, it's a source level transform that's made ridiculously easy by the fact code is data - indeed, I drop cache hints in at almost exactly the right place in ~99% of cases, I think. Certainly my trivial and naive implementation of memcpy beats what gcc can do handily, although it's still way behind my hand-coded assembler version that uses multiple loads.

Beating my head against register allocation (again) at the moment, though, along with some conditional code optimisation stuff.

oh, and you can almost entirely remove the need for stacks (you still need something like them for register spilling), if you go with a CPS transformation on your source code. You generate vast amounts of GOTOs, though.
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

Re: Thread about the languages ( another one ? )

Post by Dio »

Thanks for that. Plenty of fascinating ideas there.
venusian wrote:- An implementation doesn't have to use a linear stack - one could use a cell based linked list to implement call/return, and everything else is allocated in standard sized chunks allocated off a different linked list. Then you don't need contiguous virtual space (and that in page sized increments) for threads and heap allocation doesn't cause fragmentation. Would work best with language level support. Also it allows call/return information to be separated from data so each can have a separate cache policy (i.e. you could exclude call/return from ever being cached thus increasing the proportion of your real data which fits in the first level cache, or the other way around.
Interesting idea. My instinct is that linked lists are traditionally a nightmare for cache and pipeline performance though... chains of pointers everywhere.
many of these systems are either state machines or asynchronous event handlers - one could save memory and improve latency with a language which explicitly supports these models. In both cases the stacks' sizes can generally be statically calculated and are small and short lived. The ubiquitous Arm Cortex M processors have hardware features to support this but the ubiquitous language used with them can't explicitly express it.
Sounds like it should be easily implemented as part of a library?
Dio wrote:specifying which functions are executed on which processor - something which can't easily be done in C because it no notion of separate threads of execution.
It does if the implementation has thread-local storage (TLS) support.

I've done a few interesting things with that recently - my biggest moment of enlightenment was using it for an assert that a function is running on the 'right' thread, and also as an interesting way (read "hack") to pass parameters around an unmodifyable interface in a thread-safe manner by abusing the TLS.

It would be interesting to have some sort of equivalent of const that you could apply to functions to specify which threadgroups they were allowed on. Probably too much for the base language, although perhaps not for static analysis annotations...
User avatar
Orangy Tang
Baaaaa!
Baaaaa!
Posts: 1794
Joined: Sun Apr 25, 2004 5:25 pm 0
Location: My secret lab
Contact:

Re: Thread about the languages ( another one ? )

Post by Orangy Tang »

It shouldn't surprise me that everyone's background affects how they approach programming to a huge extent, but it still does. For me that mostly means trying to write fully functional, polished and complete games as a one man show in my spare time while still programming 'proper' games full time at work. So that means using any means necessary to write code quicker. And by extension that means writing less code where possible, and writing code to minimise debugging time (both now and to maintain it). I like simple, straightforward, elegant code that expresses the algorithm and logic at work rather than code that's 10% algorithm and 90% dicking around with stuff the language forces you to care about.

Which is why when I see posts like Gile's obsessing over every little byte and cache line and cycle I just want to grab him and shake him and say "What are you doing man? You're wasting your precious coding time obsessing over tedious implementation details because you're control freaking out over every last byte!".

As a lone wolf programmer, time is my most precious resource, and by comparison cycles and bytes are cheap and plentiful. Computers should help me get to where I want to be faster, not drag me down with their discipline and bondage they need to be kept happy.

Oh, and languages, roughly in order: BASIC, C, x86 ASM, Java, Prolog, C++, Python, GLSL, C#, Javascript, Ruby, 6800 asm, Lua.
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
User avatar
Orangy Tang
Baaaaa!
Baaaaa!
Posts: 1794
Joined: Sun Apr 25, 2004 5:25 pm 0
Location: My secret lab
Contact:

Re: Thread about the languages ( another one ? )

Post by Orangy Tang »

Darkflame wrote:Anyone had a go at Scala?

Got a big book sitting near me but I haven't given it a go yet.
I've been meaning to have a go at it for a while - there's a lot of cool JVM languages these days. JPython and JRuby are particularly handy for game scripting but their IDE support is still a little lacking.
[ Triangular Pixels.net - play Snowman Village, Rescue Squad, NiGHTS 4k and more ] [ Development Journal ]
User avatar
teamonkey
Sheepie Whore
Sheepie Whore
Posts: 12082
Joined: Thu Jun 13, 2002 1:07 am 0
XBL Gamertag: itsthetaste
PSN: teamonkey_ca
Contact:

Re: Thread about the languages ( another one ? )

Post by teamonkey »

BASIC
68K
C
C++
x86
Python
Pascal
PHP
Javascript
Bash
FORTRAN
Ada
Lua
VB
Actionscript
C#
Ruby
Scheme
Common Lisp
F#
Forth
Erlang
Haskell

After learning Scheme things went a bit weird, in the same way that the Beatles went a bit weird after trying LSD. I wouldn't call myself an expert in all of those, mind.
Post Reply