New Programming Guide

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
davelacey
Experienced Member
Posts: 104
Joined: Fri Dec 11, 2009 8:29 pm

New Programming Guide

Post by davelacey »

Hi,
A new version of the the xC programming guide is available here:

https://www.xmos.com/xc-programming-guide

You can get it as a PDF here:

https://www.xmos.com/download/public/XM ... on)(B).pdf

The guide is written assuming some existing knowledge of C programming. We are really keen to improve this document over time so please post any comments/feedback you have to this thread. Also, any suggestions of what kind of programming examples you would like to see added to the second section would be appreciated.

Dave


teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

Post by teachop »

Thank you, it is nice!
User avatar
octal
XCore Addict
Posts: 228
Joined: Thu Jan 27, 2011 3:30 pm
Location: Argenteuil - France
Contact:

Post by octal »

I read part of this new guide. Nice work.
I did understood nothing in section 2.2.1- Interface connections. I think a task oriented presentation with small examples would make this thing a lot easier (or maybe I'm too much influenced by the old book and the description of inter-task comm using channels, streaming chan and other transactions ...).
teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

Post by teachop »

octal wrote:I read part of this new guide. Nice work.
I did understood nothing in section 2.2.1- Interface connections. I think a task oriented presentation with small examples would make this thing a lot easier (or maybe I'm too much influenced by the old book and the description of inter-task comm using channels, streaming chan and other transactions ...).
I see the point. Maybe they went with a higher level explanation because if the tasks are combined, interfaces don't use channels. So this discussion is generic and focusing just on the interface, targeted at developers perhaps. Channels including streaming discussion is in there directly following.

As a noob I am happy to have this book. It is handy from the perspective of programmers finding everything in one place. Things that escaped my notice before I am now learning, like the capability to extend interfaces.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

Hi David

Thanks for getting this out, it's nice to have a single up to date reference for the language again.

I have a question, I see the new extend functionality for interfaces which I hadn't seen documented before very nice BTW, However even though the interface is implicitly passed by client for usage it is not for the implementation. I find this a bit confusing, particularly since you use the name 'self' in the example for the interface extended. I am wondering why not make it implicit and always called self, what is the benefit of adding naming to an implicitly passed interface, surely this just adds typing and confusion?

regards
Al
teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

Post by teachop »

I think it will be easier to find if the Guide is also linked on the "Programming in C and XC" page for support documentation. Thanks!
Last edited by teachop on Fri May 09, 2014 10:56 pm, edited 1 time in total.
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Folknology wrote:I have a question, I see the new extend functionality for interfaces which I hadn't seen documented before very nice BTW, However even though the interface is implicitly passed by client for usage it is not for the implementation. I find this a bit confusing, particularly since you use the name 'self' in the example for the interface extended. I am wondering why not make it implicit and always called self, what is the benefit of adding naming to an implicitly passed interface, surely this just adds typing and confusion?
We wanted to leave the door open to specifying extension methods on types other than interfaces in future. In this case the explicit self parameter lets you to specify how self should be passed, for example:

Code: Select all

extends struct foo : {
  int getX(const struct foo &self) { return self.x; }
  void setX(struct foo &self, int val) { self.x = val; }
}
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

Oh I see, that is rather interesting, how do we know what is supported by extend and what isn't moving forward?

regards
Al
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Folknology wrote:Oh I see, that is rather interesting, how do we know what is supported by extend and what isn't moving forward?
Currently you can only extend client interfaces. Extension methods on other types is just something that might be useful in future and we wanted to keep the possibility open. There are no immediate plans to add it to an upcoming release.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

Thanks for the clarification Richard I asked because I was surprised to here about 'extends' having not seen it in the html programming documentation on Xmos.com and only found out about it via the new programming guide.

regards
Al
Post Reply