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
New Programming Guide
Thank you, it is nice!
- octal
- XCore Addict
- Posts: 228
- Joined: Thu Jan 27, 2011 3:30 pm
- Location: Argenteuil - France
- Contact:
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 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.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 ...).
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.
- Folknology
- XCore Legend
- Posts: 1274
- Joined: Thu Dec 10, 2009 10:20 pm
- Contact:
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
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
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.
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: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?
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; }
}
- Folknology
- XCore Legend
- Posts: 1274
- Joined: Thu Dec 10, 2009 10:20 pm
- Contact:
Oh I see, that is rather interesting, how do we know what is supported by extend and what isn't moving forward?
regards
Al
regards
Al
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.Folknology wrote:Oh I see, that is rather interesting, how do we know what is supported by extend and what isn't moving forward?
- Folknology
- XCore Legend
- Posts: 1274
- Joined: Thu Dec 10, 2009 10:20 pm
- Contact:
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
regards
Al